Proposal: Language packs in their own repositories #494
caseysoftware
started this conversation in
Ideas / Feature Requests
Replies: 1 comment
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Measured against
dev-5.0.0@aee9d6f1on 2026-10-23. The phases and tasks are tracked as issues, listed in the first comment.Goal
After 5.0, core ships English only. Each of the other 12 languages lives in its own
web2project/locale-<code>repository, keeps its git history, has its own maintainers and releases, and installs intolocales/<code>/as today. A language pack is data only: no PHP, no HTML. Sites that install no packs see no change. Users set to a language that isn't installed fall back to English instead of hitting errors.Decisions (2026-10-23)
web2project/locale-<code>. The folder name inlocales/stays the same.pt_bris the only code with an underscore; its repo islocale-pt-br.web2project/locales(the 2014 copy) is archived and not used. The list of languages lives in core's README and on the docs site, and every pack repo carries the GitHub topicweb2project-locale, so https://github.com/topics/web2project-locale lists them all.Still open, not blocking: whether the post-5.0 release also ships an all-languages zip built from the packs' tags, alongside the English-only zip. This can be decided when that release is planned.
What's there today
locales/holds 300 tracked files:core.php(the loader),en/and 12 other folders of 130–185 KB each. History goes back to 2009 (136 commits). Polish lived inlocales/po/until 2026-10-16.lang.php(registers$LANGUAGES['xx_YY']),locales.php(sets$locale_char_set,LOCALE_FIRST_DAY,LOCALE_TIME_FORMAT), usually anindex.htmldirectory guard, and one.incper module. English has 20.incfiles with 1,830 strings. Onlyenandfrhave ahelp.php.locales/*/lang.php(CAppUI::loadLanguages()) and caches the list in the session. No list of languages is hard-coded.modules/<m>/locales/<code>/<m>.inc. No module in core does..incfiles.Values core reads from a pack today, and where they're used
de_DE)lang.phparray keyuser_preferences.LOCALEandconfig.host_localelang.php[1], [2]de_DE)lang.php[3]setlocale()(index.php, MonthCalendar, cleanup_functions), GanttSetDateLocale()lang.php[4],locales.phpsetlocale()suffix, Content-Type header,htmlspecialchars()locales.phpLOCALE_FIRST_DAYlocales.phpLOCALE_TIME_FORMATLOCALE_DATE_FORMATisn't read either)help.phpmodules/help/index.phpincludes itThe packs
Coverage = share of the 1,830 English strings with a non-empty translation. Stale = strings in the pack that English no longer has.
modules/help/de/help.toc.hlp(dead help system); first day is 0 (Sunday), Germany uses Mondayinstall.inc(unused); move translated help text intohelp.incnl→nl_NL; charsetISO8859-15→utf-8; first day 0, Netherlands uses Mondaypo)helpdesk.incto the Helpdesk module; native name "Portugues" → "Português (Brasil)"; first day 1, Brazil uses SundayEnglish (stays in core): charset
ISO8859-15→utf-8.The first-day and name changes are corrections to suggest, not facts to push through: each goes in its own commit, so a pack's maintainer can revert it.
The data-only pack format
A pack after conversion:
locale.ini, read withparse_ini_file($file, false, INI_SCANNER_TYPED). PHP's INI parser can't run code.utf-8everywhere and passes<system_locale>.UTF-8tosetlocale().modules/help/index.phpgets a Bootstrap template that prints only$AppUI->_()strings (title, intro, the three link descriptions) with the URLs hard-coded in core. Those strings go intohelp.inc, and fr's translated text moves there. Packs then contain no HTML at all.index.htmlguard files are optional. There's nothing executable left to protect. Keep them if you want to stop directory listings on servers that allow them.What core checks when it loads a pack
^[a-z]{2}(_[a-z]{2})?$,locale.iniexists and parses,codematches its pattern,first_dayis 0–6, and the names are non-empty and have no markup.lang.phpbut nolocale.iniis shown in System Admin as "old format, not loaded"..phpfile in a pack folder is never included.w2p_Utilities_Translations::parse()(strings,=>and commas only) and are escaped on output by$AppUI->_().Phase 1: bug fixes in 5.0 (
dev-5.0.0)These are bugs today, they don't change the languages, and they make the later removal safe for sites that skip straight from 5.0.x.
host_localeor userLOCALEpreference naming a language that isn't installed makesfindLanguage()returnnull. Thenuser_localeis null,locales//locales.phpis included (a warning), andLOCALE_FIRST_DAYis never defined, so the calendar views stop with a fatalError. Fix:setUserLocale()falls back toen_USwhen no match is found, and the seven copies ofinclude locales/<code>/locales.php+include locales/core.php(index.php ×4, calendar.php, fileviewer.php, do_preference_aed.php) become one$AppUI->loadLocale()that checksfile_exists()and falls back toen.locales/core.phpL30 (if (W2P_BASE_DIR . '...common.inc')is always true; needsfile_exists()). Already in the cleanup baseline.loadLanguages()caches in the session, so a language added or removed doesn't show until the next login. Cache per request (a static) instead.en/lang.phpcharset). This is a one-line fix to English only.Test: set a user's preference to
de_DE, renamelocales/de, and load the calendar, week view, Gantt and Help as that user. Each one comes up in English with no warnings. Then rename the folder back, and German appears without logging out.Phase 2: core changes on the post-5.0 branch (languages still in the tree)
Each step is its own commit. Converting the packs while they're still in core means the conversion is reviewed in one place, and
git filter-repothen carries the converted files and their history into each repo.locale.ini.loadLanguages()builds the same$LANGUAGESarray fromlocale.ini, sosetUserLocale(),findLanguage()and the language pickers don't change.loadLocale()definesLOCALE_FIRST_DAYfromfirst_dayand stops includinglocales.php. Remove$locale_char_setas a per-language value (keep the global set toutf-8for the callers that read it).help.phpgoes away inenandfr.locale.inifrom eachlang.php+locales.php, delete those files, then do the cleanup commits from the table, then delete stale keys (generated by the coverage script).locales/README.md, the pack contract: folder naming,locale.inikeys,.incgrammar and file names, English as the source of keys, how core validates a pack, how to install one. This is the source of every pack's README.dev/locale-coverage.php <pack-dir> [--json]: prints coverage, missing keys and stale keys, and validateslocale.ini. Exits non-zero on an invalid pack or any.phpfile. The packs' CI calls it.unit_tests/fixtures/locales/xx/(a small pack), pointCAppUITest::testTranslate(it usesestoday) at it, and add tests for the loader: a valid pack, a badlocale.ini, an old-format pack, a missing language falling back to English..gitignore:/locales/*with!/locales/core.php,!/locales/index.html,!/locales/README.md,!/locales/en/, so packs cloned into a core checkout aren't untracked files.install/install/check.phplists installed languages (and old-format packs it won't load) and links to the topic page. Translation Management gets an "Export" button that downloads the pack's.incfiles as a zip, so edits made in the browser can go back upstream as a PR. It also gets a line linking to the pack's repo.Phase 3: create the 12 repos
Scripted in
dev/split-locales.sh, run after Phase 2 is merged. For each language, on a fresh clone:Then the script adds, in one commit:
README.mdfrom the contract template: language, maintainers, coverage badge, install commands, how to contributeLICENSE(core's Clear BSD text)CODEOWNERS(initially the core maintainers).github/workflows/check.yml: on every push and PR, check out core at the branch forcore_version, rundev/locale-coverage.php, fail on any.phpfile, an invalidlocale.inior an.incthat won't parse, and post coverage and missing keys to the job summary. Onmainit also updates the badge JSON on abadgesbranch, which the README shows through a shields.io endpoint badge..github/workflows/release.yml: on av*tag, buildlocale-<code>-<version>.zip, which contains the<code>/folder ready to unzip intolocales/, and attach it to a GitHub Release.Then, with an account that can create repos in the org:
A pack's tag matches the core version whose strings it targets. A pack that's missing newer strings still works: those strings show in English, with the
locale_alertmarker if it's turned on. Open a "Maintainer wanted" issue in each repo, and pin it inlocale-de(52%).Checks per repo:
git logshows the original authors back to 2009;diff -rof the repo againstlocales/<code>/at the split commit is only the README/LICENSE/CI commit; CI is green; the release zip unpacks into a working language on a test install.Phase 4: remove the packs from core and release
git rm -r locales/{cs,de,es,fa,fr,it,nl,pl,pt,pt_br,ru,sv}, and add an "Installing a language" section with a table of the 12 repos toREADME.md. One commit, so it's easy to revert.git clone --depth 1 https://github.com/web2project/locale-de locales/deor unzip the release zip intolocales/.git pull: the pull deletes the tracked language folders; clone the packs afterwards.Phase 5: afterwards
web2project/localesstays as it is. If you want visitors to it to find the new repos, unarchive it, change the README to point to the topic page, and archive it again.modules/<m>/locales/.Rollback
Phase 1 is bug fixes. Phase 2 changes the pack format while everything is still in core, and reverting it restores the old format. Phase 4 is one commit;
git revertbrings the folders back. The repos can stay either way.Order and effort
dev-5.0.0All reactions