Skip to content

Commit

Permalink
Merge pull request #1176 from AFaust/TinyMCE-localeGeneralization
Browse files Browse the repository at this point in the history
Locale generalization so JS_LOCALE of de_DE results in use of de
  • Loading branch information
Dave Draper authored Aug 1, 2016
2 parents 91b6e2f + bc2c3c8 commit 13b07ba
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions aikau/src/main/resources/alfresco/editors/TinyMCE.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,23 @@ define(["dojo/_base/declare",
// Check that the language requested is supported...
if (config.language) {
var locales = this.supportedLocales.split(",");
var locale = "en";
var locale, bestGeneralizedLocale;
for (var i = 0, j = locales.length; i < j; i++) {
if (locales[i] === config.language) {
locale = config.language;
break;
}

if (config.language.indexOf(locales[i]) === 0)
{
if (bestGeneralizedLocale === undefined || locales[i].length > bestGeneralizedLocale.length)
{
bestGeneralizedLocale = locales[i];
}
}
}
config.language = locale;

config.language = locale || bestGeneralizedLocale || "en";
}

tinymce.baseURL = AlfConstants.URL_RESCONTEXT + "js/lib/tinymce";
Expand Down

0 comments on commit 13b07ba

Please sign in to comment.