Skip to content

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 a team and benjamindavid 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.

2 participants