ASP.NET MVC pseudo-localization - asp.net

Is there any tool I can use to perform pseudolocalization on an ASP.NET MVC app (using the Razor view engine) in order to help localizability testing?

i wrote a small utility app that lets me convert text into "pseudo".
It's based on a simple function which looks at each character in the string. If the character IsAlpha then i add an accent to it.
i add an accent by appending the character with a random diacritic mark between U+0300 and U+036F (the diacritical marks range).
So now i just localize my application/web-site like i were one of the dutch speaking localizers.
ỉ w͝rͨo͡t̮e̤ a͈͟ s̏m͈a͞l̪lͅ u͇t̽i̡l̔i͜țy̭ a͟p̉p͕ t̼h̥aͤt̖͊ l͊e̗t̘s̈́
m̶eͭ c͟o̙n̚v̈e̲r̓t̝ t͌e̽x̳t͈ i̍n̔t̖o̺ "p̪̜s̔e̊u̟d̮o̱".
I͔t͒'sͪ b̞aͧs̜e̋dͫ o̸͚n͙ a̼ s̼i̥m̢ͫpͫl͗e̺ f̙uͪn͎̉c͙t͒ḯo̾n̑ w̰h̙i̷c͟ḣ̌
l̼óoͦk͔s͑ a̬t̆ e̓a̔c̈hͭ c̚h̻a̿r̴aͭc̤t̙eͦŗ͉ i̞n̴ t̀h̸e̮ͫ s̖t͘r͕i͇n͒g̴͐.
I̳fͣ t̰ĥe̿ c͋h͡a͖r̸a̸c̟t̼e̞rͪ Ìs̀A̒l͒p̷h̗a̲ ţh̽e͚nͥ i̡ a̰d͙d̬
a̅n̊ a̐c̒c̒e̤͞n̜t̽ t̆o͑ i̴tͪ.
i̋ a̸d̋d́ a̰n̏ a͛c͏c̣͗e̾n͡t̎ b̷̞ẏ a̐p͞p̧͔eͩn͊ḍ͋ín̓g͚ t̬h͚ẹ
ćh̞a͗ŗa͖c͐t̊e̷rͅ w͙iͩt̮hͮ a͡ r͙a͋nͅd̃o͞m̚ dͬi̠a͚c̸r̾iͩt͖i͋c̭ m̓ḁr̵k̡
b̞ë́t̼w̓e̬ë́n̨ U̵+0300 a̢n͙d͜ U͕+036F͓ (t̯͉hͪ͟eͮ
d͓i͉aͣc͕̬r͜i͒t́i͓c̯a͚l̼ m̓a̅r̝̜k͎s̯ r͋ăn̪̒g̟e̱̮).
There's also an option to add padding to text, so allow for other languages not using the same amount of space as english
Today -> [T̀oͨd̼a͈̹y̭ !!]
Control Panel -> [C̊ȍńt̪r͗o͂l͇ P̈ȁñeͮl͢ !!!!!]
Oxydative Decarboxilation -> [Ŏx͞y̠dͥa͂t̿i̚v͙eͪ D̼e̖c̿aͤr͖b̐o̼x̹i͂l͖a̠t̮i̓o̧n̰ !!!!!!!!!]
And my PsuedoLocalizeText function:
function TForm1.PsuedoLocalizeText(s: WideString; AddPadding: Boolean): WideString;
var
i: Integer;
sb: TWideStringBuilder;
x: Integer;
tiny: WideString;
const
n: WideString = ''; //n=nothing
begin
//Code is public domain. No attribution required.
sb := TWideStringBuilder.Create;
try
for i := 1 to Length(s) do
begin
//http://www.fileformat.info/info/unicode/block/combining_diacritical_marks/list.htm
//U+0300 .. U+36F are combining diacritic marks
x := $300+Random($36f-$300);
if Windows.IsCharAlphaW(s[i]) then
begin
tiny := n+ s[i] + WideChar(x);
if Random(10) < 1 then
tiny := n+tiny+WideChar($300+Random($36f-$300));
sb.Append(tiny);
end
else
sb.Append(s[i]);
end;
Result := sb.ToString;
finally
sb.Free;
end;
if AddPadding then
begin
Result := '['+Result+' ';
for i := 1 to Ceil(Length(s) / 3) do
begin
Result := n+Result+'!';
end;
Result := Result+']';
end;
end;
Update My psuedolocalizer:
My next task is to have it work on *.resx, but exclude *.xx-yy.resx, so it can work on WinForms applications as well.
And of course fill in Size, Attributes, get the right icon for Folders.
Then maybe have it highlight the fr-FR or qps-ploc part of filenames.

There is a "pseudoizer" tool in the downloads for this article: http://msdn.microsoft.com/en-us/magazine/cc163991.aspx
It includes both source (winforms) and binary if you're lazy

After not finding anything quick, free and easy, I built Pseudolocalize.com! Just copy/paste/click and you've got the pseudolocalized version of your strings!

Related

XSLT-style mini transformation in Xquery?

At the moment in Xquery 3.1 (in eXist 4.7) I receive XML fragments that look like the following (from eXist's Lucene full text search):
let $text :=
<tei:text>
<front>
<tei:div>
<tei:listBibl>
<tei:bibl>There is some</tei:bibl>
<tei:bibl>text in certain elements</tei:bibl>
</tei:listBibl>
</tei:div>
<tei:div>
<tei:listBibl>
<tei:bibl>which are subject <exist:match>to</exist:match> a Lucene search</tei:bibl>
<tei:bibl></tei:bibl>
<tei:listBibl>
</tei:div>
<tei:front>
<tei:body>
<tei:p>and often produces</tei:p>
<tei:p>a hit.</tei:p>
<tei:body>
<tei:text>
Currently I have Xquery send this fragment to an XSLT stylesheet in order to transform it into HTML like this:
<td>...elements which are subject <span class="search-hit">to</span> a Lucene search and often p...
Where the stylesheet's job is to return 30 characters of text before and after <exist:match/> and put the content of <exist:match/> into a span. There is only one <exist:match/> per transformation.
This all works fine. However, it's occurred to me that it is a very small job with effectively a single transformation of only one element, the rest being a sort of string-join. I therefore wonder if this can't be done efficiently in Xquery.
In trying to do this, I'm can't seem to find a way to handle the string content up to the <exist:match/> and then the string content after <exist:match/>. My idea is, in pseudo code, to output a result like:
let $textbefore := some function to get the text before <exist:match/>
let $textafter := some function to get text before <exist:match/>
return <td>...{$textbefore}
<span class="search-hit">
{$text//exist:match/text()}
</span> {$textafter}...</td>
Is this even worth doing in Xquery vs the current Xquery -> XSLT pipeline I have?
Many thanks.
I think it can be done as
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare namespace tei = "http://example.com/tei";
declare namespace exist = "http://example.com/exist";
declare option output:method 'html';
let $text :=
<tei:text>
<tei:front>
<tei:div>
<tei:listBibl>
<tei:bibl>There is some</tei:bibl>
<tei:bibl>text in certain elements</tei:bibl>
</tei:listBibl>
</tei:div>
<tei:div>
<tei:listBibl>
<tei:bibl>which are subject <exist:match>to</exist:match> a Lucene search</tei:bibl>
<tei:bibl></tei:bibl>
</tei:listBibl>
</tei:div>
</tei:front>
<tei:body>
<tei:p>and often produces</tei:p>
<tei:p>a hit.</tei:p>
</tei:body>
</tei:text>
,
$match := $text//exist:match,
$text-before-all := normalize-space(string-join($match/preceding::text(), ' ')),
$text-before := substring($text-before-all, string-length($text-before-all) - 30),
$text-after := substring(normalize-space(string-join($match/following::text(), ' ')), 1, 30)
return
<td>...{$text-before}
<span class="search-hit">
{$match/text()}
</span> {$text-after}...</td>
which is not really much of a query in XQuery either but just some XPath selection plus some possibly expensive string joining and extraction on the preceding and following axis.

dbgrid looping to update data not working

so I have a DBGRID that has this infos :
I wanted to edit values inside that DBGRID. I provide a button with codes :
var ptlok, idp, tgl, after, kode, jlh, sql, sqla:string;
begin
while not dbgrid2.DataSource.DataSet.Eof do
begin
ptlok:=dbgrid2.DataSource.DataSet.Fields[0].AsString;
tgl:=dbgrid2.DataSource.DataSet.Fields[1].AsString;
after := stringreplace(tgl, '/', '-', [rfReplaceAll, rfIgnoreCase]);
kode:=dbgrid2.DataSource.DataSet.Fields[2].AsString;
jlh:=dbgrid2.DataSource.DataSet.Fields[3].AsString;
idp:=dbgrid2.DataSource.DataSet.Fields[4].AsString;
sql:='update kasir_opname_detail set kode='+quotedstr(kode)+',
jumlah='+quotedstr(jlh)+' where ptlokasi='+quotedstr(ptlok)+' and
tanggal=to_date('+quotedstr(after)+','+quotedstr('dd-mm-yyyy')+')'+' and
idpay='+quotedstr(idp)+'';
sqla:=sql;
zquery13.close;
zquery13.sql.clear;
zquery13.sql.add(sqla);
zquery13.execsql;
dbgrid2.DataSource.dataset.Next;
showmessage(sqla);
//end;
label19.Caption:=sqla;
end;
showmessage('Data Berhasil Disimpan!');
end;
However the data aren't saved as expected. it will only read last line of DBGRID then updates all data with values from last line of DBGRID.
is there something wrong with the code?
(prev it works with different dbgrid)
I am using delphi 7 and oracle as database. Thanks in advance.

FreePascal mouse input when using graph window?

GetMouseX does not work when using a graph window.
uses wincert,graph,winmouse;
var x,y:integer;
Begin
x:=GetMouseX;
End.
This gives me Error:Identifier not found "GetMouseX".
Trying this with unit 'mouse' works in the console window, but not in the graphics window.
Can anyone please help?
Yes, winmouse is not a version/subset of mouse like wincrt is a subset of crt for windows "graph" use..
It is just an unit to let mouse work with graph. Look at the unit to see what functions are available (lpressed,rpressed,getlastbuttonpress etc)
After a long search I managed to find a list of functions for winmouse. The page was in... Polish or something, but the example code worked like a charm.
uses graph, wincrt, winmouse;
var gd,gm: integer;
ch:char;
i:integer;
mposx, mposy, state: longint;
begin
gd := d4bit;
gm := m640x480;
initgraph(gd,gm,'');
initmouse;
randomize;
for i:=1 to 10 do
circle(random(640),random(480),150);
repeat
if keypressed then ch:= readkey;
if lpressed then
begin
repeat until not lpressed;
getmousestate(mposx,mposy,state);
if getpixel(mposx,mposy)<15 then
begin
setfillstyle(solidfill,random(14)+1);
floodfill(mposx,mposy,15);
end;
end;
until ch = #27;
closegraph;
end.
Thanks for the help.

How to load an image to Turbo Pascal using the graph unit

I need to load a single bitimage to a Pascal program, is there a way to do it or I must draw pixel by pixel?
As far as I remember, Turbo pascal had functions
GetImage(X1, Y1, X2, Y2: integer; var BitMap)
PutImage(X, Y: integer; var BitMap; BitBlt: word);
BitMap is just a chunk of memory with the bitmap. This way you can get image from screen to memory and vice versa. I think there is no direct function to get image from file to screen. But if you have image in right format on the disc, you can load it to memory and then use PutImage.
By using graph unit you can load BGI graphics in turbo pascal.
Refer this for more info...
http://pascal-programming.info/lesson8.php
Here is a sample code from the above link...
Program Lesson8_Program1;
Uses Crt,Graph;
Var GraphicsDriver, GraphicsMode,
ErrCode : Integer;
{two var's are needed for initialisation}
Begin
Writeln('Initialising Graphics, please wait...');
GraphicsDriver := Detect;
InitGraph(GraphicsDriver, GraphicsMode,'');
{IMPORTANT, read the following or
otherwise graphics will not work!! ;)}
(*between the inverted commas,
type in the path of the graphics BGI file
(usually 'C:\TP\BGI'),
OR
change the dir in the file menu (PRESS Alt+F)
and roll down your mouse pointer to the 'change dir'
menu; then either type the path to the BGI file,
or go to C: -> TP -> BGI*)
ErrCode := GraphResult;
If GraphResult <> grOK then { <> means 'not equal to' }
Begin
ClrScr;
Writeln('Graphics error occured: ',
GraphErrorMsg(ErrCode));
Writeln('If a file not found error is displayed above');
Writeln('then, change the dir from the current');
Writeln('location to C:\ -> TP -> BGI, '+
+'from the file menu!');
Readln;
Halt(1);
End Else
Begin
Randomize;
SetColor(Random(15) + 1); {Set text colour}
{Output text at 20 pixels from the top of the screen,
and 20 other from the left side of the screen.}
OutTextXY(20,20,'Welcome to the new generation
of Pascal Programming:');
OutTextXY(20,30,'Pascal Graphics!!');
OutTextXY(25,70,'You will learn more
graphics procedures and');
OutTextXY(25,80,'functions, later in this lesson :-)');
Readln;
End;
CloseGraph;
End.
Refer this for more info...
http://pascal-programming.info/lesson8.php

How to format timevalue to HH:MM:SS in datalabel

So i have a bar graph in crystal reports. On this graph i have a data label attached to each of the graphs that displays the value of the graph in seconds, which appears like so:
What i would like to do is format this data-label into a time formatting. So for each bar in the graph it would have the data-label appear in the following format:
HH:MM:SS.
i am able to get the time formatting to appear using the following formula:
local NumberVar Sec;
local NumberVar ss;
local NumberVar mm;
local NumberVar hh;
local StringVar SSS;
local StringVar MMM;
Sec := Sum ({GetAlarmSummaryDataSet2Response/GetAlarmSummaryDataSet2Result/Items/AlarmSummaryItem2.StopTime}, {GetAlarmSummaryDataSet2Response/GetAlarmSummaryDataSet2Result/Items/AlarmSummaryItem2.Section}) ;
hh := Int (Sec/3600);
mm :=Int ((Sec/60)- (60* Int(Sec/3600 )));
If mm<10 then MMM := "0" & ToText (mm,0);
If mm>9 Then MMM := ToText(mm,0) ;
ss :=Sec-(3600 * hh ) - (60 * mm ) ;
If ss<10 then SSS := "0" & ToText (ss,0);
If ss>9 Then SSS := ToText(ss,0) ;
ToText ( hh,0) & ":" & MMM & ":" & SSS
But what i am unsure of is how to implement this formula onto a data label.
Any help or suggestions are greatly appreciated.
Thank you
You can choose to display the group name, and you can display and format the summarized value calculated by the chart, but you can't provide a custom formula. It just isn't possible using the chart library in CR XI.
My eventual workaround for this problem:
Modify the value formula to eliminate the aggregate function. (This is necessary because Crystal won't allow an aggregate function in a group name field -- see #2.)
For the group name, specify a formula with the text you want to display in the riser. Include both the label and the formatted value, separated by Chr(13) & Chr(10) to place them on separate lines.
Configure the riser to display the label, not the value.
To apply this to your problem you'd need to make these changes:
Eliminate the aggregate function. Of course I don't know if this will be possible using your setup. Perhaps if you're using a DBMS you could use a SQL command or a stored procedure to calculate the sum before the data reaches Crystal.
Print the label and value together, either on the riser or the X-axis.
If that's not good enough for your application, you might consider CRChart, a commercial replacement which tries to address the sometimes-crippling limitations of Crystal's chart library. (I thought it was too pricey.) I think the #APPEND_DATATEXT macro would let you place a custom value on a riser, but you'd still need to move the summary to the server.

Resources