Translate a key to the current locale. Lookup order: external override file (if loaded) -> active locale bundle -> English root bundle -> the key itself.
(String key)
| 77 | * bundle -> English root bundle -> the key itself. |
| 78 | */ |
| 79 | public static String tr(String key) { |
| 80 | if (key == null) { |
| 81 | return null; |
| 82 | } |
| 83 | ResourceBundle ov = overrideBundle; |
| 84 | if (ov != null) { |
| 85 | try { |
| 86 | return ov.getString(key); |
| 87 | } catch (MissingResourceException ignored) { |
| 88 | } |
| 89 | } |
| 90 | ResourceBundle b = bundle; |
| 91 | try { |
| 92 | return b.getString(key); |
| 93 | } catch (MissingResourceException ignored) { |
| 94 | } |
| 95 | try { |
| 96 | return defaultBundle.getString(key); |
| 97 | } catch (MissingResourceException ignored) { |
| 98 | } |
| 99 | return key; |
| 100 | } |
| 101 | |
| 102 | /** Translate with MessageFormat substitution. */ |
| 103 | public static String tr(String key, Object... args) { |
no outgoing calls
no test coverage detected