Browse Source

I18n国际化toLocale(Locale locale)方法增加Variant判断

lsh 1 year ago
parent
commit
9f44e63f5f
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/main/java/com/jfinal/i18n/I18n.java

+ 3 - 0
src/main/java/com/jfinal/i18n/I18n.java

@@ -103,6 +103,9 @@ public class I18n {
 	}
 	
 	public static String toLocale(Locale locale) {
+		if(locale.getVariant() != null && !locale.getVariant().isEmpty()) {
+			return locale.getLanguage() + "_" + locale.getCountry()+"_"+locale.getVariant();
+		}
 		return locale.getLanguage() + "_" + locale.getCountry();
 	}
 }