import rt 3.0.12
[freeside.git] / rt / lib / RT / StyleGuide.pod
1 =head1 NAME
2
3 RT::StyleGuide - RT Style Guide
4
5 =head1 INTRODUCTION
6
7 All code and documentation that is submitted to be included in the RT
8 distribution should follow the style in this document.  This is not to
9 try to stifle your creativity, but to make life easier for everybody who
10 has to work with your code, and to aid those who are not quite sure how
11 to do something.
12
13 These conventions below apply to perl modules, web programs, and
14 command-line programs, specifically, but also might apply to some
15 degree to any Perl code written for use in RT.
16
17 Note that these are all guidelines, not unbreakable rules.  If you have
18 a really good need to break one of the rules herein, however, then it is
19 best to ask on the B<rt-devel> mailing list first.
20
21 Note that with much of this document, it is not so much the Right Way as
22 it is Our Way.  We need to have conventions in order to make life easier
23 for everyone.  So don't gripe, and just follow it, because you didn't
24 get a good grade in "Plays Well With Others" in kindergarten and you
25 want to make up for it now.
26
27 If you have any questions, please ask us on the B<rt-devel> mailing list:
28
29         http://www.bestpractical.com/rt/lists.html
30
31 We don't always follow this guide.  We are making changes throughout
32 our code to be in line with it.  But just because we didn't do
33 it yet, that is no excuse.  Do it anyway.  :-)
34
35 This document is subject to change at the whims of the core RT team.
36 We hope to add any significant changes at the bottom of the document.
37
38
39 =head1 CODING PRINCIPLES
40
41 =head2 Perl Version
42
43 We code everything to perl 5.6.1. Some features require advanced unicode
44 features in perl 5.8.0. It is acceptable that unicode features work only for 
45 US-ASCII on perl 5.6.1. 
46
47
48 =head2 Documentation
49
50 All modules will be documented using the POD examples in the module
51 boilerplate.  The function, purpose, use of the module will be
52 explained, and each public API will be documented with name,
53 description, inputs, outputs, side effects, etc.
54
55 If an array or hash reference is returned, document the size of the
56 array (including what each element is, as appropriate) and name each key
57 in the hash.  For complex data structures, map out the structure as
58 appropriate (e.g., name each field returned for each column from a DB
59 call; yes, this means you shouldn't use "SELECT *", which you shouldn't
60 use anyway).
61
62 Also document what kind of data returned values are.  Is it an integer,
63 a block of HTML, a boolean?
64
65 All command-line program options will be documented using the
66 boilerplate code for command-line programs, which doesn't yet exist.
67 Each available function, switch, etc. should be documented, along
68 with a statement of function, purpose, use of the program.  Do not
69 use the same options as another program, for a different purpose.
70
71 All web templates should be documented with a statement of function,
72 purpose, and use in a mason comment block.
73
74 Any external documents, and documentation for command-line programs and
75 modules, should be written in POD, where appropriate. From there, they
76 can be translated to many formats with the various pod2* translators. 
77 Read the perlpod manpage before writing any POD, because although POD is
78 not difficult, it is not what most people are used to.  It is not a
79 regular markup language; it is just a way to make easy documentation
80 for translating to other formats.  Read, and understand, the perlpod
81 manpage, and ask us or someone else who knows if you have any questions.
82
83
84 =head2 Version
85
86 Our distribution versions use tuples, where the first number is the
87 major revision, the second number is the version, and third
88 number is the subversion.  Odd-numbered versions are development
89 versions.  Examples:
90
91         1.0.0           First release of RT 1
92         1.0.1           Second release of RT 1.0
93         1.0.10          etc.
94         1.1.0           First development release of RT 1.2 (or 2.0)
95         2.0.0           First release of RT 2
96
97 Versions can be modified with a hyphen followed by some text, for
98 special versions, or to give extra information.  Examples:
99
100         2.0.0-pre1      Notes that this is not final, but preview
101
102 In perl 5.6.0, you can have versions like C<v2.0.0>, but this is not
103 allowed in previous versions of perl.  So to convert a tuple version
104 string to a string to use with $VERSION, use a regular integer for
105 the revision, and three digits for version and subversion.  Examples:
106
107         1.1.6   ->      1.001006
108         2.0.0   ->      2.000000
109
110 This way, perl can use the version strings in greater-than and
111 less-than comparisons.
112
113
114 =head2 Comments
115
116 All code should be self-documenting as much as possible.  Only include
117 necessary comments.  Use names like "$ticket_count", so you don't need to
118 do something like:
119
120         # ticket count
121         my $tc = 0;
122
123 Include any comments that are, or might be, necessary in order for
124 someone else to understand the code.  Sometimes a simple one-line
125 comment is good to explain what the purpose of the following code is
126 for.  Sometimes each line needs to be commented because of a complex
127 algorithm.  Read Kernighan & Pike's I<Practice of Programming> about
128 commenting.  Good stuff, Maynard.
129
130
131 =head2 Warnings and Strict
132
133 All code must compile and run cleanly with "use strict" enabled and the
134 perl "-w" (warnings) option on.  If you must do something that -w or
135 strict complains about, there are workarounds, but the chances that you
136 really need to do it that way are remote.
137
138 =head2 Lexical Variables
139
140 Use only lexical variables, except for special global variables
141 ($VERSION, %ENV, @ISA, $!, etc.) or very special circumstances (see
142 %HTML::Mason::Commands::session ).  Global variables
143 for regular use are never appropriate.  When necessary, "declare"
144 globals with "use vars" or "our()".
145
146 A lexical variable is created with my().  A global variable is
147 pre-existing (if it is a special variable), or it pops into existence
148 when it is used.  local() is used to tell perl to assign a temporary
149 value to a variable.  This should only be used with special variables,
150 like $/, or in special circumstances.  If you must assign to any global
151 variable, consider whether or not you should use local().
152
153 local() may also be used on elements of arrays and hashes, though there
154 is seldom a need to do it, and you shouldn't.
155
156
157 =head2 Exporting
158
159 Do not export anything from a module by default.  Feel free to put
160 anything you want to in @EXPORT_OK, so users of your modules can
161 explicitly ask for symbols (e.g., "use Something::Something qw(getFoo
162 setFoo)"), but do not export them by default.
163
164
165 =head2 Pass by Reference
166
167 Arrays and hashes should be passed to and from functions by reference
168 only.  Note that a list and an array are NOT the same thing.  This
169 is perfectly fine:
170
171         return($user, $form, $constants);
172
173 An exception might be a temporary array of discrete arguments:
174
175         my @return = ($user, $form);
176         push @return, $constants if $flag;
177         return @return;
178
179 Although, usually, this is better (faster, easier to read, etc.):
180
181         if ($flag) {
182                 return($user, $form, $constants);
183         } else {
184                 return($user, $form);
185         }
186
187 We need to talk about Class::ReturnValue here.
188
189
190 =head2 Garbage Collection
191
192 Perl does pretty good garbage collection for you.  It will automatically
193 clean up lexical variables that have gone out of scope and objects whose
194 references have gone away.  Normally you don't need to worry about
195 cleaning up after yourself, if using lexicals.
196
197 However, some glue code, code compiled in C and linked to Perl, might
198 not automatically clean up for you.  In such cases, clean up for
199 yourself.  If there is a method in that glue to dispose or destruct,
200 then use it as appropriate.
201
202 Also, if you have a long-running function that has a large data
203 structure in it, it is polite to free up the memory as soon as you are
204 done with it, if possible.
205
206         my $huge_data_structure = get_huge_data_structure();
207         do_something_with($huge_data_structure);
208         undef $huge_data_structure;
209
210 =head2 DESTROY
211
212 All object classes must provide a DESTROY method.  If it won't do
213 anything, provide it anyway:
214
215         sub DESTROY { }
216
217
218
219 =head2 die() and exit()
220
221 Don't do it.  Do not die() or exit() from a web template or module.  Do
222 not call C<kill 9, $$>.  Don't do it.
223
224 In command-line programs, do as you please.
225
226
227 =head2 shift and @_
228
229 Do not use @_.  Use shift.  shift may take more lines, but Jesse thinks it 
230 leads to cleaner code.
231
232         my $var = shift;                        # right
233         my($var) = @_;                          # ick. no
234         sub foo { uc $_[0] }                    # icky. sometimes ok.
235
236
237         my($var1, $var2) = (shift, shift);      # Um, no.
238
239         my $var1 = shift;                       # right
240         my $var2 = shift;                       
241
242
243
244 =head2 Tests
245
246 Modules should provide test code, with documentation on how to use
247 it. Test::Inline allows tests to be embedded in code. Test::More makes it 
248 easy to create tests. Any code you write should have a testsuite.
249 Any code you alter should have a test suite. If a patch comes in without
250 tests, there is something wrong.
251
252 When altering code, you must run the test harness before submitting a patch
253 or committing code to the repository. 
254
255 "make regression" will extract inline tests, blow away the system database
256 and run the test suite.
257
258 "make regression-quiet" will do all that and not print the "ok" lines.
259
260
261
262 =head2 STDIN/STDOUT
263
264 Always report errors using $RT::Logger. It's a Log::Dispatch object.
265 Unlike message meant for the user, log messages are not to be
266 internationalized.
267
268 There are several different levels ($RT::Logger methods) of logging:
269
270 =over 4
271
272 =item debug
273
274 Used for messages only needed during system debugging.
275
276 =item info
277
278 Should be used to describe "system-critical" events which aren't errors.
279 Examples: creating users, deleting users, creating tickets, creating queues,
280 sending email (message id, time, recipients), recieving mail, changing
281 passwords, changing access control, superuser logins)
282
283 =item error
284
285 Used for RT-generated failures during execution.
286
287 =item crit
288
289 Should be used for messages when an action can not be completed due to some
290 error condition beyond our control.
291
292 =back
293
294 In the web UI and modules, never print directly to STDERR.  Do not print
295 directly to STDOUT, unless you need to print directly to the user's console.
296
297 In command-line programs, feel free to print to STDERR and STDOUT as
298 needed for direct console communication. But for actual error reporting,
299 use the logging API.
300
301
302 =head2 System Calls
303
304 Always check return values from system calls, including open(),
305 close(), mkdir(), or anything else that talks directly to the system. 
306 Perl built-in system calls return the error in $!; some functions in
307 modules might return an error in $@ or some other way, so read the module's
308 documentation if you don't know.  Always do something, even if it is
309 just calling $RT::Logger->warning(), when the return value is not what you'd expect.
310
311
312
313 =head1 STYLE
314
315 Much of the style section is taken from the perlsyle manpage.  We make
316 some changes to it here, but it wouldn't be a bad idea to read that
317 document, too.
318
319 =head2 Terminology
320
321 =over 4
322
323 =item RT the name
324
325 "RT" is the name of the project.  "RT" is, optionally, the
326 specific name for the actual file distribution.  That's it. 
327
328 While we sometimes use "RT2" or "RT3", that's shortand that's really
329 not recommended. The name of the project is "RT".
330
331 To specify a major version, use "RT 3.0".
332 To specify a specific release, use "RT 3.0.12"
333
334 =item function vs. sub(routine) vs. method
335
336 Just because it is the Perl Way (not necessarily right for all
337 languages, but the documented terminology in the perl documentation),
338 "method" should be used only to refer to a subroutine that are object
339 methods or class methods; that is, these are functions that are used
340 with OOP that always take either an object or a class as the first
341 argument. Regular subroutines, ones that are not object or class
342 methods, are functions.  Class methods that create and return an object
343 are optionally called constructors.
344
345 =item Users
346
347 "users" are normally users of RT, the ones hitting the site; if using
348 it in any other context, specify.  
349 "system users" are user
350 names on the operating system.  "database users" are the user names in
351 the database server.  None of these needs to be capitalized.
352
353 =back
354
355
356 =head2 Names
357
358 Don't use single-character variables, except as iterator variables.
359
360 Don't use two-character variables just to spite us over the above rule.
361
362 Constants are in all caps; these are variables whose value will I<never>
363 change during the course of the program.
364
365         $Minimum = 10;          # wrong
366         $MAXIMUM = 50;          # right
367
368 Other variables are lowercase, with underscores separating the words. 
369 They words used should, in general, form a noun (usually singular),
370 unless the variable is a flag used to denote some action that should be
371 taken, in which case they should be verbs (or gerunds, as appropriate)
372 describing that action.
373
374         $thisVar      = 'foo';  # wrong
375         $this_var     = 'foo';  # right
376         $work_hard    = 1;      # right, verb, boolean flag
377         $running_fast = 0;      # right, gerund, boolean flag
378
379 Arrays and hashes should be plural nouns, whether as regular arrays and
380 hashes or array and hash references.  Do not name references with "ref"
381 or the data type in the name.
382
383         @stories     = (1, 2, 3);      # right
384         $comment_ref = [4, 5, 6];      # wrong
385         $comments    = [4, 5, 6];      # right
386         $comment     = $comments->[0]; # right
387
388 Make the name descriptive.  Don't use variables like "$sc" when you
389 could call it "$story_count".  See L<"Comments">.
390
391 There are several variables in RT that are used throughout the code,
392 that you should use in your code.  Do not use these variable names for
393 anything other than how they are normally used, and do not use any
394 other variable names in their place.  Some of these are:
395
396         $self           # first named argument in object method
397
398 Subroutines (except for special cases, like AUTOLOAD and simple accessors)
399 begin with a verb, with words following to complete the action.  Accessors
400 don't start with "Get" if they're just the name of the attribute.
401
402 Accessors which return an object should end with the suffix Obj.
403
404 This section needs clarification for RT.
405
406 Words begin with a capital letter.  They
407 should as clearly as possible describe the activity to be peformed, and
408 the data to be returned. 
409
410
411
412         Load();         # good
413         LoadByName();   # good
414         LoadById();             # good
415
416 Subroutines beginning with C<_> are special: they are not to be used
417 outside the current object.  There is not to be enforced by the code
418 itself, but by someone very big and very scary.
419
420 For large for() loops, do not use $_, but name the variable.
421 Do not use $_ (or assume it) except for when it is absolutely
422 clear what is going on, or when it is required (such as with
423 map() and grep()).
424
425         for (@list) {
426                 print;                  # OK; everyone knows this one
427                 print uc;               # wrong; few people know this
428                 print uc $_;            # better
429         }
430
431 Note that the special variable C<_> I<should> be used when possible.
432 It is a placeholder that can be passed to stat() and the file test
433 operators, that saves perl a trip to re-stat the file.  In the
434 example below, using C<$file> over for each file test, instead of
435 C<_> for subsequent uses, is a performance hit.  You should be
436 careful that the last-tested file is what you think it is, though.
437
438         if (-d $file) {         # $file is a directory
439                 # ...
440         } elsif (-l _) {        # $file is a symlink
441                 # ...
442         }
443
444 Package names begin with a capital letter in each word, followed by
445 lower case letters (for the most part).  Multiple words should be StudlyCapped.
446
447         RT::User                        # good
448         RT::Database::MySQL             # proper name
449         RT::Display::Provider           # good
450         RT::CustomField                 # not so good, but OK
451
452 Plugin modules should begin with "RTx::", followed by the name
453 of the plugin.  
454
455 =head1 Code formatting
456
457 Use perltidy. Anything we say here is wrong if it conflicts with what
458 perltidy does. Your perltidyrc should read:
459
460 -lp -vt=2 -vtc=2 -nsfs -bar                                                                                             
461
462 =head2 Indents and Blank Space
463
464 All indents should be tabs.  Set your tab stops whatever you want them
465 to be; I use 8 spaces per tabs.
466
467 No space before a semicolon that closes a statement.
468
469         foo(@bar) ;     # wrong
470         foo(@bar);      # right
471
472 Line up corresponding items vertically.
473
474         my $foo   = 1;
475         my $bar   = 2;
476         my $xyzzy = 3;
477
478         open(FILE, $fh)   or die $!;
479         open(FILE2, $fh2) or die $!;
480
481         $rot13 =~ tr[abcedfghijklmnopqrstuvwxyz]
482                     [nopqrstuvwxyzabcdefghijklm];
483
484         # note we use a-mn-z instead of a-z,
485         # for readability
486         $rot13 =~ tr[a-mn-z]
487                     [n-za-m];
488
489 Put blank lines between groups of code that do different things.  Put
490 blank lines after your variable declarations.  Put a blank line before a
491 final return() statement.  Put a blank line following a block (and
492 before, with the exception of comment lines).
493
494 An example:
495
496         # this is my function!
497         sub foo {
498                 my $val = shift;
499                 my $obj = new Constructor;
500                 my($var1, $var2);
501
502                 $obj->SetFoo($val);
503                 $var1 = $obj->Foo();
504
505
506                 return($val);
507         }
508
509         print 1;
510
511
512 =head2 Parentheses
513
514 For control structures, there is a space between the keyword and opening
515 parenthesis.  For functions, there is not.
516
517         for(@list)      # wrong
518         for (@list)     # right
519
520         my ($ref)       # wrong
521         my($ref)        # right
522
523 Be careful about list vs. scalar context with parentheses!
524
525         my @array = ('a', 'b', 'c');
526         my($first_element) = @array;            # a
527         my($first_element) = ('a', 'b', 'c');   # a
528         my $element_count  = @array;            # 3
529         my $last_element   = ('a', 'b', 'c');   # c
530
531 Always include parentheses after functions, even if there are no arguments.
532 There are some exceptions, such as list operators (like print) and unary
533 operators (like undef, delete, uc).
534
535 There is no space inside the parentheses, unless it is needed for
536 readability.
537
538         for ( map { [ $_, 1 ] } @list ) # OK
539         for ( @list )                   # not really OK, not horrible
540
541 On multi-line expressions, match up the closing parenthesis with either
542 the opening statement, or the opening parenthesis, whichever works best.
543 Examples:
544
545         @list = qw(
546                 bar
547                 baz
548         );                      # right
549
550         if ($foo && $bar && $baz
551                  && $buz && $xyzzy
552         ) {
553                 print $foo;
554         }
555
556 Whether or not there is space following a closing parenthesis is
557 dependent on what it is that follows.
558
559         print foo(@bar), baz(@buz) if $xyzzy;
560
561 Note also that parentheses around single-statement control expressions,
562 as in C<if $xyzzy>, are optional (and discouraged) C<if> it is I<absolutely>
563 clear -- to a programmer -- what is going on.  There is absolutely no
564 need for parentheses around C<$xyzzy> above, so leaving them out enhances
565 readability.  Use your best discretion.  Better to include them, if
566 there is any question.
567
568 The same essentially goes for perl's built-in functions, when there is
569 nothing confusing about what is going on (for example, there is only one
570 function call in the statement, or the function call is separated by a
571 flow control operator).  User-supplied functions must always include
572 parentheses.
573
574         print 1, 2, 3;                          # good
575         delete $hash{key} if isAnon($uid);      # good
576
577
578 However, if there is any possible confusion at all, then include the
579 parentheses.  Remember the words of Larry Wall in the perlstyle manpage:
580
581         When in doubt, parenthesize.  At the very least it will
582         let some poor schmuck bounce on the % key in vi.
583
584         Even if you aren't in doubt, consider the mental welfare
585         of the person who has to maintain the code after you, and
586         who will probably put parens in the wrong place.
587
588 So leave them out when it is absoutely clear to a programmer, but if
589 there is any question, leave them in.
590
591
592 =head2 Braces
593
594 (This is about control braces, not hash/data structure braces.)
595
596 There is always a space befor the opening brace.
597
598         while (<$fh>){  # wrong
599         while (<$fh>) { # right
600
601 A one-line block may be put on one line, and the semicolon may be
602 omitted.
603
604         for (@list) { print }
605
606 Otherwise, finish each statement with a semicolon, put the keyword and
607 opening curly on the first line, and the ending curly lined up with the
608 keyword at the end.
609
610         for (@list) {
611                 print;
612                 smell();
613         }
614
615 Generally, we prefer "uncuddled elses":
616
617         if ($foo) {
618                 print;
619         }
620         else {
621                 die;
622         }
623
624 _If_ the if statement is very brief, sometimes "cuddling" the else makes code more readable. Feel free to cuddle them in that case:
625
626
627         if ($foo) {
628                 print;
629         } else {
630                 die;
631         }
632
633 =head2 Operators
634
635 Put space around most operators.  The primary exception is the for
636 aesthetics; e.g., sometimes the space around "**" is ommitted,
637 and there is never a space before a ",", but always after.
638
639         print $x , $y;  # wrong
640         print $x, $y;   # right
641
642         $x = 2 >> 1;    # good
643         $y = 2**2;      # ok
644
645 Note that "&&" and "||" have a higher precedence than "and" and "or". 
646 Other than that, they are exactly the same.  It is best to use the lower
647 precedence version for control, and the higher for testing/returning
648 values.  Examples:
649
650         $bool = $flag1 or $flag2;       # WRONG (doesn't work)
651         $value = $foo || $bar;          # right
652         open(FILE, $file) or die $!;
653
654         $true  = foo($bar) && baz($buz);
655         foo($bar) and baz($buz);
656
657 Note that "and" is seldom ever used, because the statement above is
658 better written using "if":
659
660         baz($buz) if foo($bar);
661
662 Most of the time, the confusion between and/&&, or/|| can be alleviated
663 by using parentheses.  If you want to leave off the parentheses then you
664 I<must> use the proper operator.  But if you use parentheses -- and
665 normally, you should, if there is any question at all -- then it doesn't
666 matter which you use.  Use whichever is most readable and aesthetically
667 pleasing to you at the time, and be consistent within your block of code.
668
669 Break long lines AFTER operators, except for "and", "or", "&&", "||".
670 Try to keep the two parts to a binary operator (an operator that
671 has two operands) together when possible.
672
673         print "foo" . "bar" . "baz"
674                 . "buz";                        # wrong
675
676         print "foo" . "bar" . "baz" .
677                 "buz";                          # right
678
679         print $foo unless $x == 3 && $y ==
680                 4 && $z == 5;                   # wrong
681
682         print $foo unless $x == 3 && $y == 4
683                 && $z == 5;                     # right
684
685
686 =head2 Other
687
688 Put space around a complex subscript inside the brackets or braces.
689
690         $foo{$bar{baz}{buz}};   # OK
691         $foo{ $bar{baz}{buz} }; # better
692
693 In general, use single-quotes around literals, and double-quotes
694 when the text needs to be interpolated. 
695
696 It is OK to omit quotes around names in braces and when using
697 the => operator, but be careful not to use a name that doubles as
698 a function; in that case, quote.
699
700         $what{'time'}{it}{is} = time();
701
702 When making compound statements, put the primary action first.
703
704         open(FILE, $fh) or die $!;      # right
705         die $! unless open(FILE, $fh);  # wrong
706
707         print "Starting\n" if $verbose; # right
708         $verbose && print "Starting\n"; # wrong
709
710
711 Use here-docs instead of repeated print statements.
712
713                 print <<EOT;
714         This is a whole bunch of text.
715         I like it.  I don't need to worry about messing
716         with lots of print statements and lining them up.
717         EOT
718
719 Just remember that unless you put single quotes around your here-doc
720 token (<<'EOT'), the text will be interpolated, so escape any "$" or "@"
721 as needed.
722
723 =head1 INTERNATIONALIZATION
724
725
726 =head2 String extraction styleguide
727
728 =over 4
729
730 =item Web templates
731
732 Templates should use the /l filtering component to call the localisation
733 framework
734
735 The string              Foo!
736
737 Should become           <&|/l&>Foo!</&>
738
739 All newlines should be removed from localized strings, to make it easy to 
740 grep the codebase for strings to be localized
741
742 The string              Foo
743                         Bar
744                         Baz
745                         
746 Should become           <&|/l&>Foo Bar Baz</&>
747
748
749 Variable subsititutions should be moved to Locale::MakeText format
750
751 The string              Hello, <%$name %>
752
753 should become           <&|/l, $name &>Hello, [_1]</&>  
754
755
756 Multiple variables work just like single variables
757  
758 The string              You found <%$num%> tickets in queue <%$queue%>
759
760 should become           <&|/l, $num, $queue &>You found [_1] tickets in queue [_2]</&>
761
762 When subcomponents are called in the middle of a phrase, they need to be escaped
763 too:
764
765 The string               <input type="submit" value="New ticket in">&nbsp<& /Elements/SelectNewTicketQueue&>
766
767 should become           <&|/l, $m->scomp('/Elements/SelectNewTicketQueue')&><input type="submit" value="New ticket in">&nbsp;[_1]</&>
768
769
770
771
772 The string      <& /Elements/TitleBoxStart, width=> "40%", titleright => "RT $RT::VERSION for   $RT::rtname", title => 'Login' &>
773
774 should become   <& /Elements/TitleBoxStart, 
775                         width=> "40%",
776                         titleright => loc("RT [_1] for [_2]",$RT::VERSION, $RT::rtname),
777                         title => loc('Login'),
778                 &>
779         
780
781 =item Library code                      
782
783
784
785 Within RT's core code, every module has a localization handle available through the 'loc' method:
786
787 The code        return ( $id, "Queue created" );
788
789 should become   return ( $id, $self->loc("Queue created") );    
790
791 When returning or localizing a single string, the "extra" set of parenthesis () should be omitted.
792
793 The code        return ("Subject changed to ". $self->Data );
794
795 should become    return $self->loc( "Subject changed to [_1]", $self->Data );
796
797
798 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.
799
800
801 =back 4
802
803 =head1 CODING PRCEDURE
804
805 This is for new programs, modules, specific APIs, or anything else.
806
807 =over 4
808
809 =item Present idea to rt-devel
810
811 We may know of a better way to approach the problem, or know of an
812 existing way to deal with it, or know someone else is working on it. 
813 This is mostly informal, but a fairly complete explanation for the need
814 and use of the code should be provided.
815
816
817 =item Present complete specs to rt-devel
818
819 The complete proposed API  should be submitted for
820 approval and discussion.  For web and command-line programs, present the
821 functionality and interface (op codes, command-lin switches, etc.).
822
823 The best way to do this is to take the documentation portion of the
824 boilerplate and fill it in.  You can make changes later if necessary,
825 but fill it in as much as you can.
826
827
828
829 =item Prepare for code review
830
831 When you are done, the code will undergo a code review by a member of
832 the core team, or someone picked by the core team.  This is not to
833 belittle you (that's just a nice side effect), it is to make sure that
834 you understand your code, that we understand your code, that it won't
835 break other code, that it follows the documentation and existing
836 proposal.  It is to check for possible optimizations or better ways of
837 doing it.
838
839 Note that all code is expected to follow the coding principles and style
840 guide contained in this document.
841
842
843 =item Finish it up
844
845 After the code is done (possibly going through multiple code reviews),
846 if you do not have repository access, submit it to rt-<major-version>-bugs@fsck.com as a unified diff. From that point on, it'll be handled by someone with repository access.
847
848 =back
849
850
851 =head1 BUG REPORTS, PATCHES
852
853 Use rt-<major-version>-bugs@fsck.com for I<any> bug that is not
854 being fixed immediately.  If it is not in RT, there
855 is a good chance it will not be dealt with.
856
857 Send patches to rt-<major-version>-bugs@fsck.com, too.  Use C<diff
858 -u> for patches.
859
860
861
862 =head1 TO DO
863
864 Talk about DBIx::SearchBuilder
865
866 Talk about mason
867         component style
868         cascading style sheets
869          
870 Talk about adding a new translation
871
872 Talk more about logging
873
874 =head1 CHANGES
875
876         Adapted from Slash Styleguide by jesse - 20 Dec, 2002
877
878
879 =head1 VERSION
880
881 0.1