Skip to content

Feature/dev 1088 custom locale aliases#12705

Merged
brandonkelly merged 5 commits into5.0from
feature/dev-1088-custom-locale-aliases
Mar 11, 2023
Merged

Feature/dev 1088 custom locale aliases#12705
brandonkelly merged 5 commits into5.0from
feature/dev-1088-custom-locale-aliases

Conversation

@brandonkelly
Copy link
Copy Markdown
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
Copy Markdown

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.

1 participant