1 # $File: //depot/RT/rt-devel/docs/design_docs/string-extraction-guide.txt $ $Author: ivan $
2 # $Revision: 1.1.1.2 $ $Change: 1431 $ $DateTime: 2002/10/15 17:24:45 $
4 Run 'p4 edit lib/RT/I18N/zh_tw.pm' and 'perl l10n.pl' to add new
5 extractions to the zh_tw.pm.
7 Edit lib/RT/I18N/zh_tw.pm for chinese counterparts.
9 Attached is a copy of the freshly rewritten string extraction style guide.
10 Please point out anything that's unclear or underspecified. I
11 localized a number of the core modules in RT 2.1.3 (Starting with
12 Queue_Overlay.pm). I only touched a couple of the web templates in the
13 Elements/ directory of the web ui.
15 RT String extraction styleguide:
19 Templates should use the /l filtering component to call the localisation
24 Should become <&|/l&>Foo!</&>
26 All newlines should be removed from localized strings, to make it easy to
27 grep the codebase for strings to be localized
33 Should become <&|/l&>Foo Bar Baz</&>
36 Variable subsititutions should be moved to Locale::MakeText format
38 The string Hello, <%$name %>
40 should become <&|/l, $name &>Hello, [_1]</&>
43 Multiple variables work just like single variables
45 The string You found <%$num%> tickets in queue <%$queue%>
47 should become <&|/l, $num, $queue &>You found [_1] tickets in queue [_2]</&>
49 When subcomponents are called in the middle of a phrase, they need to be escaped
52 The string <input type="submit" value="New ticket in"> <& /Elements/SelectNewTicketQueue&>
54 should become <&|/l, $m->scomp('/Elements/SelectNewTicketQueue')&><input type="submit" value="New ticket in"> [_1]</&>
58 There are places inside the web ui where strings are defined, which need to be
59 localised. it is important to note here that each localized string is split out
60 onto its own line, but never split across two lines and two localized strings
61 are never included on the same line. It is also important to note
62 that this will genereate code which will not work in RT 2.1.3. I need
63 to add a bit of framework to make it work in 2.1.4
66 The string <& /Elements/TitleBoxStart, width=> "40%", titleright => "RT $RT::VERSION for ". RT->Config->Get('rtname'), title => 'Login' &>
68 should become <& /Elements/TitleBoxStart,
70 titleright => loc("RT [_1] for [_2]",$RT::VERSION, RT->Config->Get('rtname')),
71 title => loc('Login'),
79 Within RT's core code, every module has a localization handle available through the 'loc' method:
81 The code return ( $id, "Queue created" );
83 should become return ( $id, $self->loc("Queue created") );
85 When returning or localizing a single string, the "extra" set of parenthesis () should be omitted.
87 The code return ("Subject changed to ". $self->Data );
89 should become return $self->loc( "Subject changed to [_1]", $self->Data );
92 It is important not to localize the names of rights or statuses within RT's core, as there is logic that depends on them as string identifiers. The proper place to localize these values is when they're presented for display in the web or commandline interfaces.
99 http://www.bestpractical.com/products/rt -- Trouble Ticketing. Free.