globalizejs / globalizejs/globalize

How to handle if locale folder missing for any module (e.g.) number module ?

Open
#886 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.8k
Forks
585
PR merge metrics
No merged PRs in 30d

Description

I am initializing Globalize dynamically, How should I handle if the selected locale's cldr data missing?

```
locale = $("#selectedLocale").val());

$.ajaxSetup({ async: false });
const likelySubtags = $.getJSON("../../node_modules/cldr-data/supplemental/likelySubtags.json");
const numberingSystems = $.getJSON("../../node_modules/cldr-data/supplemental/numberingSystems.json");
const numbers = $.getJSON("../../node_modules/cldr-numbers-full/main/" + locale+ "/numbers.json");

Globalize.load(likelySubtags.responseJSON);
Globalize.load(numberingSystems.responseJSON);
Globalize.load(numbers.responseJSON);
$.ajaxSetup({ async: true });

Globalize.locale(locale);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.