Skip to content

Commit

Permalink
Merge branch 'v2-dev' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Oct 22, 2021
2 parents d8124c5 + 8ad3cee commit aa0478c
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ workflows:
only:
- dev
- v2
ignore:
- v2-dev
- build_next:
requires:
Expand All @@ -138,6 +139,7 @@ workflows:
only:
- dev
- v2
ignore:
- v2-dev
- publish_next:
requires:
Expand All @@ -147,6 +149,7 @@ workflows:
only:
- dev
- v2
ignore:
- v2-dev
release:
jobs:
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.JSON
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
{
"versions": [
{
"version": "2.10.0",
"changes": {
"new": [],
"enhancements": [],
"fixes": [
"`TaxonomyPicker`: suggestions language is always English [#879](https://github.com/pnp/sp-dev-fx-controls-react/issues/879)"
]
},
"contributions": [
"[Peter Paul Kirschner](https://github.com/petkir)"
]
},
{
"version": "2.9.0",
"changes": {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pnp/spfx-controls-react",
"description": "Reusable React controls for SharePoint Framework solutions",
"version": "2.9.0",
"version": "2.10.0",
"engines": {
"node": ">=10"
},
Expand Down
70 changes: 70 additions & 0 deletions src/common/utilities/LocalesHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
export class LocalesHelper {

private static locales = {
1025: 'ar-SA',
1026: 'bg-BG',
1027: 'ca-ES',
1028: 'zh-TW',
1029: 'cs-CZ',
1030: 'da-DK',
1031: 'de-DE',
1032: 'el-GR',
1033: 'en-US',
1035: 'fi-FI',
1036: 'fr-FR',
1037: 'he-IL',
1038: 'hu-HU',
1040: 'it-IT',
1041: 'ja-JP',
1042: 'ko-KR',
1043: 'nl-NL',
1044: 'nb-NO',
1045: 'pl-PL',
1046: 'pt-BR',
1048: 'ro-RO',
1049: 'ru-RU',
1050: 'hr-HR',
1051: 'sk-SK',
1053: 'sv-SE',
1054: 'th-TH',
1055: 'tr-TR',
1057: 'id-ID',
1058: 'uk-UA',
1060: 'sl-SI',
1061: 'et-EE',
1062: 'lv-LV',
1063: 'lt-LT',
1066: 'vi-VN',
1068: 'az-Latn-AZ',
1069: 'eu-ES',
1071: 'mk-MK',
1081: 'hi-IN',
1086: 'ms-MY',
1087: 'kk-KZ',
1106: 'cy-GB',
1110: 'gl-ES',
1164: 'prs-AF',
2052: 'zh-CN',
2070: 'pt-PT',
2108: 'ga-IE',
3082: 'es-ES',
5146: 'bs-Latn-BA',
9242: 'sr-Latn-RS',
10266: 'sr-Cyrl-RS',
};
public static getLocaleId(localeName: string): number {
const pos: number = Object.keys(this.locales).findIndex(locKey => this.locales[locKey] === localeName);
if (pos > -1) {
return parseInt(Object.keys(this.locales)[pos]);
}
else {
return 0;
}
}

public static getLocaleName(localeId: number): string {
return this.locales[localeId] || '';
}


}
1 change: 1 addition & 0 deletions src/common/utilities/SPHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import '@pnp/sp/fields';
import { SPHttpClient } from '@microsoft/sp-http';
import { IFieldInfo } from '@pnp/sp/fields';
import '@pnp/sp/site-users/web';
import '@pnp/sp/webs';

declare var window: any;

Expand Down
3 changes: 2 additions & 1 deletion src/common/utilities/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './FieldRendererHelper';
export * from './GeneralHelper';
export * from './SPHelper';
export * from './SPHelper';
export * from './LocalesHelper';
10 changes: 5 additions & 5 deletions src/services/SPTermStorePickerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SPTermStoreMockHttpClient from './SPTermStorePickerMockService';
import { findIndex } from '@microsoft/sp-lodash-subset';
import { ExtensionContext } from '@microsoft/sp-extension-base';
import { EmptyGuid } from '../common/Constants';

import { LocalesHelper } from '../common/utilities/LocalesHelper';

/**
* Service implementation to manage term stores in SharePoint
Expand Down Expand Up @@ -297,7 +297,7 @@ export default class SPTermStorePickerService {
return null;
}
}
else{
else {
return null;
}
} catch (error) {
Expand Down Expand Up @@ -327,7 +327,7 @@ export default class SPTermStorePickerService {
const {
termsetNameOrID,
hideDeprecatedTags,
hideTagsNotAvailableForTagging,
hideTagsNotAvailableForTagging,
} = this.props;

const terms = await this.getAllTermsByAnchorId(
Expand Down Expand Up @@ -424,10 +424,10 @@ export default class SPTermStorePickerService {
resolve(null);
return;
}

let loc = LocalesHelper.getLocaleId(this.context.pageContext.cultureInfo.currentUICultureName);
let data = {
start: searchText,
lcid: this.context.pageContext.web.language, // TODO : get the user's navitation LCID. Here it's the default web language LCID
lcid: loc !== 0 ? loc : this.context.pageContext.web.language,
sspList: this.cleanGuid(termStore[0].Id),
termSetList: TermSetId,
anchorId: this.props.anchorId ? this.props.anchorId : EmptyGuid,
Expand Down

0 comments on commit aa0478c

Please sign in to comment.