From 40ad48b9ddcf42ba32f84d27d6b7c4b6918f4844 Mon Sep 17 00:00:00 2001 From: Ali Hamdi Date: Wed, 9 Aug 2023 17:07:19 +0100 Subject: [PATCH] fix: set correctly the Onlyoffice editor language - EXO-64615 --- .../onlyoffice/OnlyofficeEditorServiceImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/src/main/java/org/exoplatform/onlyoffice/OnlyofficeEditorServiceImpl.java b/services/src/main/java/org/exoplatform/onlyoffice/OnlyofficeEditorServiceImpl.java index 7e94e248e..36ce8aca9 100644 --- a/services/src/main/java/org/exoplatform/onlyoffice/OnlyofficeEditorServiceImpl.java +++ b/services/src/main/java/org/exoplatform/onlyoffice/OnlyofficeEditorServiceImpl.java @@ -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; }