diff --git a/test-app/app/templates/docs/localization.md b/test-app/app/templates/docs/localization.md index 06c4accf..b8a876d1 100644 --- a/test-app/app/templates/docs/localization.md +++ b/test-app/app/templates/docs/localization.md @@ -1,28 +1,23 @@ -## Localization +# Localization flatpickr supports [over 25 languages](https://github.com/flatpickr/flatpickr/tree/master/src/l10n). -### Default Language +## Default Language If you want to switch the default language for all flatpickr instances, you can do so by setting the language using the static flatpickr method localize: ```js +import flatpickr from 'flatpickr'; import lang from 'flatpickr/dist/l10n'; flatpickr.localize(lang.fr); ``` -### Per-Instance Language +## Per-Instance Language -If you want to use a different language for a specific flatpickr instance, you can do so by passing the language to the `locale` option: +If you want to use a different language for a specific flatpickr instance, you can do so by passing the language to the `locale` option using a `string` or a `locale object` : -#### String locale - -If you want to use a string to identify the locale, the lang file must be loaded in your app from `flatpickr/dist/l10n`: - -```js - import 'flatpickr/dist/l10n/fr'; -``` +### String locale ```handlebars ``` -#### Object locale +### Locale object -You can also pass a locale object to the `locale` option: +You can also pass a `locale object` imported from flatpickr to the `locale` option: ```js import lang from 'flatpickr/dist/l10n'; @@ -52,9 +47,9 @@ You can also pass a locale object to the `locale` option: /> ``` -### Manual Localization Configuration +## Manual Localization Configuration -`locales` option also accepts an object for [custom locale configuration](https://chmln.github.io/flatpickr/#locale). This is useful for reusing app locale code. +`locales` option also accepts an object for [custom locale configuration](https://flatpickr.js.org/localization/#localization-in-a-browser-environment). This is useful for reusing app locale code. The following example is using `moment.js` and assumes that a `userLocale` is specified to look up the correct locale configuration from `moment.js`. @@ -93,4 +88,4 @@ export default class SomeController extends Controller { /> ``` -Check [flatpickr locale documentation](https://chmln.github.io/flatpickr/#locale) for a list of config options. \ No newline at end of file +Check [flatpickr locale documentation](https://flatpickr.js.org/localization/) for a list of config options.