Changes between Initial Version and Version 1 of Ja:DevelopersGuide/StyleGuide


Ignore:
Timestamp:
2013-11-15T14:39:38+01:00 (12 years ago)
Author:
Shirayuki
Comment:

translate

Legend:

Unmodified
Added
Removed
Modified
  • Ja:DevelopersGuide/StyleGuide

    v1 v1  
     1[[TranslatedPages(revision=21)]]
     2= 開発ガイドライン =
     3
     4== How your code should look like ==
     5
     6 * make sure the code is Java 1.6 compatible
     7 * make sure there is no trailing white space
     8 * don't use multiple consecutive empty lines
     9 * JOSM uses 4 characters indentation and no tab stops
     10 * Document your code '''thoroughly'''. Many people will thank you :)
     11
     12== How your javadoc should look like ==
     13 * The [http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#styleguide Oracle Javadoc style guide] is used as the base guide
     14 * {{{@since}}} is used for public classes and methods (visible to plugin developers) with the JOSM revision that introduced the element. Example: {{{@since 5408}}}
     15   * {{{@since}}} is updated when a public method signature changes or if a class is renamed
     16   * {{{@since}}} can be omitted for public methods and fields introduced at the same time as the class, provided they do not have changed and the class is correctly documented.
     17 * {{{@throws}}} is preferred to {{{@exception}}}
     18
     19=== Eclipseの設定 ===
     20[[Image(styleguide_compiler_16.png,700px)]]
     21
     22[[Image(ss1.png,700px)]]
     23
     24[[Image(ss2.png,700px)]]
     25
     26[[Image(ss3.png,700px)]]
     27
     28
     29== 国際化 ==
     30
     31 * make sure you use {{{tr(...)}}} for all localized strings
     32   {{{
     33   import import static org.openstreetmap.josm.tools.I18n.tr;
     34
     35   // use tr(...) for exception messages
     36   //
     37   throw new Exception(tr("error message always in tr()"));
     38
     39   // use tr(...) for labels, title, tooltip texts and the like
     40   //
     41   new JLabel(tr("Label always in tr()"));
     42
     43   // etc.
     44   }}}
     45
     46
     47 * never assemble localized messages with {{{+}}}. Use format
     48   placeholders instead.
     49
     50   '''DONT'''
     51   {{{new JLabel(tr("My Label " + labelId));}}}
     52
     53
     54   '''DO'''
     55   {{{new JLabel(tr("My Label {0}",labelId));}}}
     56   
     57   Only exception: {{{+}}} can be used to break long lines of non-variable texts.
     58
     59 * When using apostrophe, the following rules apply:
     60   
     61   For all {{{tr}}} the apostrophe is special. (Like backslash in C)[[BR]]
     62   It needs to be escaped by another apostrophe:
     63
     64   {{{new JButton(tr("Don''t press me more than {0} times!", n))}}}