X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2FI18nManager.java;h=24a4fde41ab2a73288dcdb7975c9c7791f54cf47;hp=349db3fcaff83bace412ebdf02e459b28d1e9199;hb=326f489e36aa7f235bc19409a57bf4955cd50f24;hpb=8c8868ae29b3252f02e094c02307384cf61ba667 diff --git a/tim/prune/I18nManager.java b/tim/prune/I18nManager.java index 349db3f..24a4fde 100644 --- a/tim/prune/I18nManager.java +++ b/tim/prune/I18nManager.java @@ -115,4 +115,22 @@ public abstract class I18nManager // return the key itself return inKey; } + + /** + * Lookup the given key and return the associated text, formatting with the number + * @param inKey key to lookup (text should contain a %d) + * @param inNumber number to substitute into the %d + * @return associated text, or the key if not found + */ + public static String getTextWithNumber(String inKey, int inNumber) + { + String localText = getText(inKey); + try + { + localText = String.format(localText, inNumber); + } + catch (Exception e) + {} // printf formatting didn't work, maybe the placeholders are wrong? + return localText; + } }