Util: Add isRTL()

This commit is contained in:
zzz
2020-02-25 14:45:10 +00:00
parent 4a845f0b73
commit 594f1c7f8b
2 changed files with 20 additions and 1 deletions

View File

@ -242,7 +242,7 @@ class SummaryRenderer {
if (started > start && started < end) {
// String legend = _t("Restart") + ' ' + sdf.format(new Date(started)) + " UTC " + event.getValue() + "\\l";
String legend;
if ("ar".equals(lang) || "fa".equals(lang) || "iw".equals(lang)) {
if (Messages.isRTL(lang)) {
// RTL languages
legend = _t("Restart") + ' ' + sdf.format(new Date(started)) + " - " + event.getValue() + "\\l";
} else {

View File

@ -153,6 +153,25 @@ public abstract class Translate {
return lang;
}
/**
* Are we configured for a right-to-left language?
* @return true for supported RTL languages
* @since 0.9.46
*/
public static boolean isRTL(I2PAppContext ctx) {
return isRTL(getLanguage(ctx));
}
/**
* Is this a right-to-left language?
* @param lang Two- or three-letter lower case
* @return true for supported RTL languages
* @since 0.9.46
*/
public static boolean isRTL(String lang) {
return lang.equals("ar") || lang.equals("fa") || lang.equals("iw");
}
/**
* Two-letter upper case or ""
* @return country in routerconsole.country property, else current locale