File tree Expand file tree Collapse file tree 3 files changed +83
-6
lines changed Expand file tree Collapse file tree 3 files changed +83
-6
lines changed 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 as any ) . values ( this . locales ) . indexOf ( 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
+ const pos : number = Object . keys ( this . locales ) . indexOf ( localeId . toString ( ) ) ;
67
+ if ( pos > - 1 ) {
68
+ return ( Object as any ) . values ( this . locales ) [ pos ] ;
69
+ }
70
+ else {
71
+ return '' ;
72
+ }
73
+ }
74
+
75
+
76
+ }
Original file line number Diff line number Diff line change 1
1
export * from './FieldRendererHelper' ;
2
2
export * 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';
15
15
import { findIndex } from '@microsoft/sp-lodash-subset' ;
16
16
import { ExtensionContext } from '@microsoft/sp-extension-base' ;
17
17
import { EmptyGuid } from '../common/Constants' ;
18
-
18
+ import { LocalesHelper } from '../common/utilities/LocalesHelper' ;
19
19
20
20
/**
21
21
* Service implementation to manage term stores in SharePoint
@@ -297,7 +297,7 @@ export default class SPTermStorePickerService {
297
297
return null ;
298
298
}
299
299
}
300
- else {
300
+ else {
301
301
return null ;
302
302
}
303
303
} catch ( error ) {
@@ -327,7 +327,7 @@ export default class SPTermStorePickerService {
327
327
const {
328
328
termsetNameOrID,
329
329
hideDeprecatedTags,
330
- hideTagsNotAvailableForTagging,
330
+ hideTagsNotAvailableForTagging,
331
331
} = this . props ;
332
332
333
333
const terms = await this . getAllTermsByAnchorId (
@@ -424,10 +424,10 @@ export default class SPTermStorePickerService {
424
424
resolve ( null ) ;
425
425
return ;
426
426
}
427
-
427
+ let loc = LocalesHelper . getLocaleId ( this . context . pageContext . cultureInfo . currentUICultureName ) ;
428
428
let data = {
429
429
start : searchText ,
430
- lcid : this . context . pageContext . web . language , // TODO : get the user's navitation LCID. Here it's the default web language LCID
430
+ lcid : loc !== 0 ? loc : this . context . pageContext . web . language ,
431
431
sspList : this . cleanGuid ( termStore [ 0 ] . Id ) ,
432
432
termSetList : TermSetId ,
433
433
anchorId : this . props . anchorId ? this . props . anchorId : EmptyGuid ,
You can’t perform that action at this time.
0 commit comments