Get Locales
Once you have initialized the CdnClient, you can get the locales that are available in the metafile.
Get All Locales
js
import { CdnClient } from '@localazy/cdn-client';
const cdn = await CdnClient.create({
metafile: 'https://delivery.localazy.com/_a855374211039568660198b39c31/_e0.v2.json',
});
const result = cdn.metafile.locales();
1
2
3
4
5
6
7
2
3
4
5
6
7
example result
js
const result = [
{
isBaseLocale: true,
isRtl: false,
language: 'en',
locale: 'en',
localizedName: 'English',
name: 'English',
region: '',
script: '',
},
{
isBaseLocale: false,
isRtl: false,
language: 'ms',
locale: 'ms_BN',
localizedName: 'Malay (Brunei)',
name: 'Malay (Brunei)',
region: 'BN',
script: '',
},
{
isBaseLocale: false,
isRtl: false,
language: 'ms',
locale: 'ms#Arab',
localizedName: 'Malay (Arabic)',
name: 'Malay (Arabic)',
region: '',
script: 'Arab',
},
{
isBaseLocale: false,
isRtl: false,
language: 'ms',
locale: 'ms_ID#Latn',
localizedName: 'Malay (Indonesia, Latin)',
name: 'Malay (Indonesia, Latin)',
region: 'ID',
script: 'Latn',
},
];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Get All Locales Except the Base Locale
js
import { CdnClient } from '@localazy/cdn-client';
const cdn = await CdnClient.create({
metafile: 'https://delivery.localazy.com/_a855374211039568660198b39c31/_e0.v2.json',
});
const result = cdn.metafile.locales({
excludeBaseLocale: true,
});
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
example result
js
const result = [
{
isBaseLocale: false,
isRtl: false,
language: 'ms',
locale: 'ms_BN',
localizedName: 'Malay (Brunei)',
name: 'Malay (Brunei)',
region: 'BN',
script: '',
},
{
isBaseLocale: false,
isRtl: false,
language: 'ms',
locale: 'ms#Arab',
localizedName: 'Malay (Arabic)',
name: 'Malay (Arabic)',
region: '',
script: 'Arab',
},
{
isBaseLocale: false,
isRtl: false,
language: 'ms',
locale: 'ms_ID#Latn',
localizedName: 'Malay (Indonesia, Latin)',
name: 'Malay (Indonesia, Latin)',
region: 'ID',
script: 'Latn',
},
];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Get Base Locale
js
import { CdnClient } from '@localazy/cdn-client';
const cdn = await CdnClient.create({
metafile: 'https://delivery.localazy.com/_a855374211039568660198b39c31/_e0.v2.json',
});
const result = cdn.metafile.baseLocale;
1
2
3
4
5
6
7
2
3
4
5
6
7
example result
js
const result = {
isBaseLocale: true,
isRtl: false,
language: 'en',
locale: 'en',
localizedName: 'English',
name: 'English',
region: '',
script: '',
};
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10