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

LocalizationValidationScripts LocalizationValidiationScriptsTagHelperComponent wrong culture #16

Closed
FJGR65 opened this issue Jan 17, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@FJGR65
Copy link

FJGR65 commented Jan 17, 2021

When "culture" is replaced in the following scripts, they cannot be downloaded because they do not exist.
This happens when using culture names such as "en-US" or "es-ES".
Only the first two characters should be selected: "en" or "es". For these cultures, if there are downloads.

<script type="text/javascript">
    $.when(
        $.get("https://cdn.jsdelivr.net/gh/unicode-cldr/cldr-core@{cldr-core-version}/supplemental/likelySubtags.json"),
        $.get("https://cdn.jsdelivr.net/gh/unicode-cldr/cldr-numbers-full@{cldr-core-version}/main/{culture}/numbers.json"),
        $.get("https://cdn.jsdelivr.net/gh/unicode-cldr/cldr-numbers-full@{cldr-core-version}/main/{culture}/currencies.json"),
        $.get("https://cdn.jsdelivr.net/gh/unicode-cldr/cldr-core@{cldr-core-version}/supplemental/numberingSystems.json"),
        $.get("https://cdn.jsdelivr.net/gh/unicode-cldr/cldr-dates-full@{cldr-core-version}/main/{culture}/ca-gregorian.json"),
        $.get("https://cdn.jsdelivr.net/gh/unicode-cldr/cldr-dates-full@{cldr-core-version}/main/{culture}/timeZoneNames.json"),
        $.get("https://cdn.jsdelivr.net/gh/unicode-cldr/cldr-core@{cldr-core-version}/supplemental/timeData.json"),
        $.get("https://cdn.jsdelivr.net/gh/unicode-cldr/cldr-core@{cldr-core-version}/supplemental/weekData.json")
    ).then(function () {
        // Normalize $.get results, we only need the JSON, not the request statuses.
        return [].slice.apply(arguments, [0]).map(function (result) {
            return result[0];
        });
    }).then(Globalize.load).then(function () {
        Globalize.locale("{culture}");
    });
</script>
@LazZiya
Copy link
Owner

LazZiya commented Jan 18, 2021

It seems that these two cultures (en-US and es-ES) are not available in cldr-numbers in jsdelivr network. This is not the case for all cultures, the majority of the cultures are available as two and four letter coded names.

Thanks @FJGR65 for submitting this issue, I will provide a hotfix soon.

@LazZiya LazZiya self-assigned this Jan 18, 2021
@LazZiya LazZiya added enhancement New feature or request good first issue Good for newcomers labels Jan 18, 2021
LazZiya added a commit that referenced this issue Jan 21, 2021
@LazZiya
Copy link
Owner

LazZiya commented Aug 1, 2021

The issue fixed in dd0c66e but somehow I missed to close it in time.

Now the cultures that has no relevant script exists in the cldr-numbers will be trimmed to the parent culture. Currently two cultures are in the list en-us and es-es, more cultures to be added if necessary.

string[] nonSupportedCultres = { "en-us", "es-es" };
culture = nonSupportedCultres.Any(x => x.Equals(culture, StringComparison.OrdinalIgnoreCase))
        ? culture.Split('-')[0]
        : culture;

@LazZiya LazZiya closed this as completed Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants