Skip to content

Commit

Permalink
fix: set correctly the Onlyoffice editor language - EXO-64615 (#207)
Browse files Browse the repository at this point in the history
The property lang was holding a wrong value of the language like en- or fr- which was not interpreted correctly by the onlyoffice editor and the language was always set to Enlish and Aerbidjan country (defaults)
The fix returns just the language (without the country variant), it adds the country language just for Taiwan chinese and Portugal portuguese as detailed in documentation https://api.onlyoffice.com/editors/config/editor#lang
  • Loading branch information
ahamdi committed Aug 10, 2023
1 parent ed09b73 commit 72d5ed6
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2476,7 +2476,12 @@ public static String getUserLanguage(String userId) {
String lang = Locale.getDefault().getLanguage();
if(localePolicy != null) {
Locale locale = localePolicy.determineLocale(localeCtx);
lang = locale.getLanguage() + "-" + locale.getCountry();
lang = locale.getLanguage();
// In case of pt_PT or cn_TW we have to add the country
// as detailed in https://api.onlyoffice.com/editors/config/editor#lang
if("PT".equalsIgnoreCase(locale.getCountry()) || "TW".equalsIgnoreCase(locale.getCountry())) {
lang = locale.getLanguage() + "-" + locale.getCountry();
}
}
return lang;
}
Expand Down

0 comments on commit 72d5ed6

Please sign in to comment.