Localize reply header based on detected language

This commit is contained in:
M66B
2020-03-27 12:40:44 +01:00
parent af0e83d03b
commit 538525440c
3 changed files with 31 additions and 9 deletions

View File

@@ -752,6 +752,16 @@ public class Helper {
}
}
static String getString(Context context, String language, int resid, Object... formatArgs) {
if (language == null)
return context.getString(resid, formatArgs);
Configuration configuration = new Configuration(context.getResources().getConfiguration());
configuration.setLocale(new Locale(language));
Resources res = context.createConfigurationContext(configuration).getResources();
return res.getString(resid, formatArgs);
}
static String[] getStrings(Context context, int resid, Object... formatArgs) {
return getStrings(context, null, resid, formatArgs);
}