Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dev 1088 custom locale aliases #12705

Merged
merged 5 commits into from
Mar 11, 2023

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Feb 20, 2023

Description

Adds support for custom locale aliases, via a new localeAliases config setting.

Locale aliases can be selected alongside ICU-defined locales in users’ “Formatting Locale” settings and sites’ “Language” settings.

Example locale alias definition:

// config/general.php
return GeneralConfig::create()
    ->localeAliases([
        'smj' => [
            'aliasOf' => 'sv',
            'displayName' => 'Lule Sámi',
        ],
    ]);

A side effect of this change is that there could now be locale IDs floating around that aren’t actually understood by the Intl extension, which could cause errors. So plugins and modules should be careful to always instantiate craft\i18n\Locale objects via craft\i18n\I18N::getLocaleById($id) rather than new Locale($id).

Related issues

@brandonkelly brandonkelly requested review from benjamindavid and a team as code owners February 20, 2023 20:16
@linear
Copy link

linear bot commented Feb 20, 2023

DEV-1088 Custom locale aliases

It should be possible to define aliases of existing locales, with custom locale IDs and display names.

@brandonkelly brandonkelly merged commit c473bef into 5.0 Mar 11, 2023
@brandonkelly brandonkelly deleted the feature/dev-1088-custom-locale-aliases branch March 11, 2023 16:13
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.

None yet

1 participant