Skip to content

Include Plupload i18n file in generated language pack#5707

Open
Kanonimpresor wants to merge 1 commit into
e107inc:masterfrom
Kanonimpresor:feat/lancheck-plupload-i18n
Open

Include Plupload i18n file in generated language pack#5707
Kanonimpresor wants to merge 1 commit into
e107inc:masterfrom
Kanonimpresor:feat/lancheck-plupload-i18n

Conversation

@Kanonimpresor

Copy link
Copy Markdown
Contributor

Problem

When an admin generates a Language Pack from Admin → Tools → Language Check → Generate Language Pack (e107_admin/lancheck.php), the resulting ZIP bundles .php/.xml from e107_languages/, e107_plugins/, e107_themes/, e107_handlers/ and e107_docs/help/, but it never includes the Plupload uploader translation at e107_web/js/plupload/i18n/<iso>.js.

As a consequence, a fresh install of any generated pack leaves the Plupload uploader (file manager, media manager, mailout attachments, …) in English no matter which site language is selected. Translators currently have to ship the .js out-of-band or tell users to copy it manually.

Fix

getFileList() is the single place that builds the array of files handed to $archive->create($data, PCLZIP_OPT_REMOVE_PATH, e_BASE). The fix resolves the ISO-639-1 code from the existing findLocale() helper and, only if e107_web/js/plupload/i18n/<iso>.js exists, appends it to that list:

$locale = $this->findLocale($language);
if($locale)
{
    $iso = strtolower(substr($locale, 0, 2));
    $pluploadJs = e_WEB.'js/plupload/i18n/'.$iso.'.js';
    if(is_readable($pluploadJs))
    {
        $file[] = $pluploadJs;
    }
}

Because the archive is created with PCLZIP_OPT_REMOVE_PATH e_BASE, the file is stored at the correct path e107_web/js/plupload/i18n/<iso>.js inside the ZIP — no extra $archive->add() call needed.

Behaviour

Scenario Result
Spanish selected, es.js exists es.js packaged at e107_web/js/plupload/i18n/es.js
Portuguese selected, pt.js exists pt.js packaged
Locale has no plupload .js yet Pack still generated; nothing added (silent, legacy behaviour)
findLocale() can't resolve Skipped silently

Scope / safety

  • Single function touched (getFileList()), +16 lines, no deletions.
  • No public API changes, no new translatable strings.
  • Zero impact on installs that don't generate packs.
  • Deliberately implemented in getFileList() (not makeLanguagePack()) to stay conflict-free with PR Fix language-pack generation in lancheck.php (v2.3.5+ regressions) #5703, which is in review and edits the XML-manifest block of makeLanguagePack().
  • Core only ships en.js; this simply lets a translator's locale file be picked up automatically when present.

Refs e107translations/Translator-Information#5


Disclosure: parts of this contribution were prepared with AI assistance and reviewed by me before submission.

The Language Pack generator (lancheck.php -> getFileList) bundled .php/.xml
from languages, plugins, themes, handlers and help, but never the Plupload
uploader translation at e107_web/js/plupload/i18n/<iso>.js. As a result,
fresh installs of any generated pack left the file/media/mailout uploader in
English regardless of the selected site language.

getFileList() now resolves the ISO-639-1 code from findLocale() and, when
e107_web/js/plupload/i18n/<iso>.js exists, appends it to the archive list.
Because the archive is created with PCLZIP_OPT_REMOVE_PATH e_BASE, the file
is stored at the correct e107_web/js/plupload/i18n/<iso>.js path. Core only
ships en.js; translators can drop their locale file in and have it packaged.

Refs e107translations/Translator-Information#5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant