| Version 12 (modified by , 16 years ago) ( diff ) |
|---|
Development Guidelines ¶
How your code should look like ¶
- make sure the code is Java 1.5 compatible
- no
@Overridefor methods for implemented interfaces
- no
- make sure there is no trailing white space
- don't use multiple consecutive empty lines
- Document your code thoroughly. Many people will thank you :)
Configuring Eclipse ¶
Internationalization ¶
- make sure you use use
tr(...)for all localized stringsimport import static org.openstreetmap.josm.tools.I18n.tr; // use tr(...) for exception messages // throw new Exception(tr("error message always in tr()")); // use tr(...) for labels, title, tooltip texts and the like // new JLabel(tr("Label always in tr()")); // etc.
- never assemble localized messages with
+. Use format placeholders instead.
DONT
new JLabel(tr("My Label " + labelId));
DO
new JLabel(tr("My Label {0}",labelId));
Only exception:
+can be used to break long lines of non-variable texts.
- When using apostrophe, the following rules apply:
For simple strings without substitution you need not change anything:
new JButton(tr("Don't press me!"))
For
trwith more than one parameter, the apostrophe is special. (Like backslash in C)
It needs to be escaped by another apostrophe:
new JButton(tr("Don''t press me more than {0} times!", n))
Attachments (4)
- ss1.png (142.2 KB ) - added by 16 years ago.
- ss2.png (55.2 KB ) - added by 16 years ago.
- ss3.png (68.2 KB ) - added by 16 years ago.
- styleguide_compiler_16.png (55.0 KB ) - added by 13 years ago.
Download all attachments as: .zip





