Skip to content

Separate Portuguese regional locale exports - #17009

Draft
Blackspirits wants to merge 1 commit into
modxcms:3.xfrom
Blackspirits:fix/portuguese-locale-exports
Draft

Separate Portuguese regional locale exports#17009
Blackspirits wants to merge 1 commit into
modxcms:3.xfrom
Blackspirits:fix/portuguese-locale-exports

Conversation

@Blackspirits

@Blackspirits Blackspirits commented Aug 18, 2026

Copy link
Copy Markdown

What changed and why

This PR prevents Portuguese (Portugal) (pt-PT) and Portuguese (Brazil) (pt-BR) from being exported by Crowdin to the same pt paths.

The current Crowdin configuration uses %two_letters_code%. Both Portuguese regional variants share the ISO 639-1 code pt, so enabling both target languages can make their exported files collide. Crowdin documents languages_mapping as the mechanism for overriding placeholder values for specific languages.

This change:

  • maps Crowdin pt-BR explicitly to pt-BR;
  • maps Crowdin pt-PT explicitly to pt-PT;
  • applies the mapping to core lexicons, country lexicons, and setup lexicons;
  • adds the English source keys language_pt-BR and language_pt-PT, which are needed because MODX derives language display-name keys from the exact locale directory name;
  • retains the existing language_pt and language_pt-br keys as legacy compatibility identifiers for now.

This PR deliberately does not edit, rename, or delete any non-English lexicon files. Those translations should continue to be managed through Crowdin according to the project contribution guidelines.

The existing generic pt files are also left untouched in this change so installations already configured with pt are not broken while the regional locale migration is completed.

The current generic pt translation originated from the former Brazilian Portuguese (pt-br) lexicons. That existing Brazilian translation work should therefore be reused/migrated as the starting point for the canonical pt-BR locale in Crowdin rather than translated again from scratch. pt-PT should remain a separate translation maintained independently for European Portuguese.

How to test

  1. Validate crowdin.yml as YAML.
  2. Confirm all three translation file groups map:
    • Crowdin pt-BR -> pt-BR
    • Crowdin pt-PT -> pt-PT
  3. With the MODX Crowdin integration, verify exports resolve to distinct paths:
    • core/lexicon/pt-BR/...
    • core/lexicon/pt-PT/...
    • core/lexicon/country/pt-BR.inc.php
    • core/lexicon/country/pt-PT.inc.php
    • setup/lang/pt-BR/...
    • setup/lang/pt-PT/...
  4. Verify the installer can resolve language_pt-BR and language_pt-PT once the corresponding Crowdin exports are present.

The modified YAML was parsed successfully and the modified PHP source content passes PHP syntax validation. Full export verification requires the MODX Crowdin project/integration.

Related issue(s)/PR(s)

Related to #14659.

Compatibility notes

This is intentionally a staged migration. The existing generic pt locale and the older language_pt-br identifier are kept for backward compatibility, while the canonical regional locales are introduced as pt-PT and pt-BR.

Once the pt-PT and pt-BR exports are established and verified, the legacy pt locale and pt-br identifier can be considered for deprecation and eventual removal in a separate follow-up change. Keeping that cleanup separate avoids breaking existing installations as part of this Crowdin export fix.

Breaking change assessment

No public API signatures, return types, or defaults are changed. The legacy Portuguese identifiers are retained in this PR.

Test coverage

No PHP runtime tests were added because this change does not modify PHP runtime logic. Configuration structure and PHP syntax were validated locally; the remaining meaningful test is the Crowdin integration export itself.

Contributors

This follows the discussion in #14659 about maintaining separate European and Brazilian Portuguese localisations.

AI tool use

I used ChatGPT to help review the Crowdin configuration and MODX language-loading code, as well as to help draft this PR. The resulting changes were reviewed before submission.

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