Skip to content

Commit

Permalink
move i18n language identifier fix to tinymce, the only place where is…
Browse files Browse the repository at this point in the history
… needed
  • Loading branch information
1letter authored and petschki committed Feb 14, 2025
1 parent 40459c1 commit e68c0ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/core/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ const i18n = function () {
self.baseUrl = $("body").attr("data-i18ncatalogurl");
self.currentLanguage = $("html").attr("lang") || "en";

// Fix for country specific languages
if (self.currentLanguage.split("-").length > 1) {
self.currentLanguage =
self.currentLanguage.split("-")[0] +
"_" +
self.currentLanguage.split("-")[1].toUpperCase();
}

self.storage = null;
self.catalogs = {};
self.ttl = 24 * 3600 * 1000;
Expand Down
9 changes: 9 additions & 0 deletions src/pat/tinymce/tinymce--implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ export default class TinyMCE {
var self = this;
var i18n = new I18n();
var lang = i18n.currentLanguage;

// Fix for country specific languages
if (lang.split("-").length > 1) {
lang =
lang.split("-")[0] +
"_" +
lang.split("-")[1].toUpperCase();
}

if (lang !== "en" && self.options.tiny.language !== "en") {
try {
await import(`tinymce-i18n/langs7/${lang}`);
Expand Down

0 comments on commit e68c0ef

Please sign in to comment.