| 71 | } |
| 72 | |
| 73 | public static String tr(String s) { |
| 74 | String res; |
| 75 | try { |
| 76 | if (i18n == null) |
| 77 | res = s; |
| 78 | else |
| 79 | res = i18n.getString(s); |
| 80 | } catch (MissingResourceException e) { |
| 81 | res = s; |
| 82 | } |
| 83 | |
| 84 | // The single % is the arguments selector in .PO files. |
| 85 | // We must put double %% inside the translations to avoid |
| 86 | // getting .PO processing in the way. |
| 87 | res = res.replace("%%", "%"); |
| 88 | |
| 89 | return res; |
| 90 | } |
| 91 | |
| 92 | public static String format(String fmt, Object... args) { |
| 93 | // Single quote is used to escape curly bracket arguments. |