Summary
XoopsFormTinymce7::getLanguage() (htdocs/class/xoopseditor/tinymce7/formtinymce.php) has two paths:
if (defined('_XOOPS_EDITOR_TINYMCE7_LANGUAGE')) {
$this->language = constant('_XOOPS_EDITOR_TINYMCE7_LANGUAGE'); // fixed in #72
} else {
$this->language = str_replace('_', '-', strtolower(_LANGCODE));
if (strtolower(_CHARSET) === 'utf-8') {
$this->language .= '_utf8';
}
}
The fallback branch produces codes like zh-tw_utf8 — the lower-case hyphen form and the _utf8 suffix are TinyMCE 3 language-pack conventions. TinyMCE 7 language packs are case-sensitive with an underscore region (zh_TW.js, pt_BR.js, fr_FR.js, …) and have no _utf8 variants. So when a site has not defined _XOOPS_EDITOR_TINYMCE7_LANGUAGE, the computed code matches no TinyMCE 7 pack and the editor silently falls back to English.
#72 fixed the explicit-constant path only. This issue tracks the fallback.
Why it wasn't fixed inline
A correct fix requires decisions that shouldn't be guessed:
- The set of TinyMCE 7 locale codes XOOPS officially supports.
- A mapping from XOOPS
_LANGCODE (per language) to those codes.
- The bundled TinyMCE 7 currently ships no language packs (
htdocs/class/xoopseditor/tinymce7/js/tinymce/langs/ contains only README.md), so there is nothing in-tree to validate a mapping against.
Suggested direction
- Decide/document the supported TinyMCE 7 locale list.
- Replace the legacy transform with an explicit
_LANGCODE → TinyMCE-7-code map (and drop the _utf8 suffix unconditionally — it is invalid for TinyMCE 7).
- Add unit coverage for representative fallbacks (e.g. Traditional Chinese →
zh_TW).
References
Summary
XoopsFormTinymce7::getLanguage()(htdocs/class/xoopseditor/tinymce7/formtinymce.php) has two paths:The fallback branch produces codes like
zh-tw_utf8— the lower-case hyphen form and the_utf8suffix are TinyMCE 3 language-pack conventions. TinyMCE 7 language packs are case-sensitive with an underscore region (zh_TW.js,pt_BR.js,fr_FR.js, …) and have no_utf8variants. So when a site has not defined_XOOPS_EDITOR_TINYMCE7_LANGUAGE, the computed code matches no TinyMCE 7 pack and the editor silently falls back to English.#72 fixed the explicit-constant path only. This issue tracks the fallback.
Why it wasn't fixed inline
A correct fix requires decisions that shouldn't be guessed:
_LANGCODE(per language) to those codes.htdocs/class/xoopseditor/tinymce7/js/tinymce/langs/contains onlyREADME.md), so there is nothing in-tree to validate a mapping against.Suggested direction
_LANGCODE→ TinyMCE-7-code map (and drop the_utf8suffix unconditionally — it is invalid for TinyMCE 7).zh_TW).References