File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export class LocalesHelper {
2+
3+ private static locales = {
4+ 1025 : 'ar-SA' ,
5+ 1026 : 'bg-BG' ,
6+ 1027 : 'ca-ES' ,
7+ 1028 : 'zh-TW' ,
8+ 1029 : 'cs-CZ' ,
9+ 1030 : 'da-DK' ,
10+ 1031 : 'de-DE' ,
11+ 1032 : 'el-GR' ,
12+ 1033 : 'en-US' ,
13+ 1035 : 'fi-FI' ,
14+ 1036 : 'fr-FR' ,
15+ 1037 : 'he-IL' ,
16+ 1038 : 'hu-HU' ,
17+ 1040 : 'it-IT' ,
18+ 1041 : 'ja-JP' ,
19+ 1042 : 'ko-KR' ,
20+ 1043 : 'nl-NL' ,
21+ 1044 : 'nb-NO' ,
22+ 1045 : 'pl-PL' ,
23+ 1046 : 'pt-BR' ,
24+ 1048 : 'ro-RO' ,
25+ 1049 : 'ru-RU' ,
26+ 1050 : 'hr-HR' ,
27+ 1051 : 'sk-SK' ,
28+ 1053 : 'sv-SE' ,
29+ 1054 : 'th-TH' ,
30+ 1055 : 'tr-TR' ,
31+ 1057 : 'id-ID' ,
32+ 1058 : 'uk-UA' ,
33+ 1060 : 'sl-SI' ,
34+ 1061 : 'et-EE' ,
35+ 1062 : 'lv-LV' ,
36+ 1063 : 'lt-LT' ,
37+ 1066 : 'vi-VN' ,
38+ 1068 : 'az-Latn-AZ' ,
39+ 1069 : 'eu-ES' ,
40+ 1071 : 'mk-MK' ,
41+ 1081 : 'hi-IN' ,
42+ 1086 : 'ms-MY' ,
43+ 1087 : 'kk-KZ' ,
44+ 1106 : 'cy-GB' ,
45+ 1110 : 'gl-ES' ,
46+ 1164 : 'prs-AF' ,
47+ 2052 : 'zh-CN' ,
48+ 2070 : 'pt-PT' ,
49+ 2108 : 'ga-IE' ,
50+ 3082 : 'es-ES' ,
51+ 5146 : 'bs-Latn-BA' ,
52+ 9242 : 'sr-Latn-RS' ,
53+ 10266 : 'sr-Cyrl-RS' ,
54+ } ;
55+ public static getLocaleId ( localeName : string ) : number {
56+ const pos : number = Object . keys ( this . locales ) . findIndex ( locKey => this . locales [ locKey ] === localeName ) ;
57+ if ( pos > - 1 ) {
58+ return parseInt ( Object . keys ( this . locales ) [ pos ] ) ;
59+ }
60+ else {
61+ return 0 ;
62+ }
63+ }
64+
65+ public static getLocaleName ( localeId : number ) : string {
66+ return this . locales [ localeId ] || '' ;
67+ }
68+ }
Original file line number Diff line number Diff line change 11export * from './FieldRendererHelper' ;
22export * from './GeneralHelper' ;
3- export * from './SPHelper' ;
3+ export * from './SPHelper' ;
4+ export * from './LocalesHelper' ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import SPTermStoreMockHttpClient from './SPTermStorePickerMockService';
1515import { findIndex } from '@microsoft/sp-lodash-subset' ;
1616import { ExtensionContext } from '@microsoft/sp-extension-base' ;
1717import { EmptyGuid } from '../common/Constants' ;
18-
18+ import { LocalesHelper } from '../common/utilities/LocalesHelper' ;
1919
2020/**
2121 * Service implementation to manage term stores in SharePoint
@@ -400,10 +400,10 @@ export default class SPTermStorePickerService {
400400 resolve ( null ) ;
401401 return ;
402402 }
403-
403+ let loc = LocalesHelper . getLocaleId ( this . context . pageContext . cultureInfo . currentUICultureName ) ;
404404 let data = {
405405 start : searchText ,
406- lcid : this . context . pageContext . web . language , // TODO : get the user's navitation LCID. Here it's the default web language LCID
406+ lcid : loc !== 0 ? loc : this . context . pageContext . web . language ,
407407 sspList : this . cleanGuid ( termStore [ 0 ] . Id ) ,
408408 termSetList : TermSetId ,
409409 anchorId : this . props . anchorId ? this . props . anchorId : EmptyGuid ,
You can’t perform that action at this time.
0 commit comments