Skip to content

Commit

Permalink
Merge pull request pnp#217 from ytterstrom/master
Browse files Browse the repository at this point in the history
Include the swedish characters ÅÄÖ in people directory
  • Loading branch information
VesaJuvonen authored Dec 19, 2018
2 parents 811262e + c492b1a commit f7d7134
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default class PeopleDirectoryWebPart extends BaseClientSideWebPart<IPeopl
spHttpClient: this.context.spHttpClient,
title: this.properties.title,
displayMode: this.displayMode,
locale: this.getLocaleId(),
onTitleUpdate: (newTitle: string) => {
// after updating the web part title in the component
// persist it in web part properties
Expand All @@ -37,7 +38,9 @@ export default class PeopleDirectoryWebPart extends BaseClientSideWebPart<IPeopl
protected get dataVersion(): Version {
return Version.parse('1.0');
}

protected getLocaleId() : string {
return this.context.pageContext.cultureInfo.currentUICultureName;
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export interface IIndexNavigationProps {
* Current search query. Empty, if not searching.
*/
searchQuery: string;
/**
* Current locale
*/
locale: string;
/**
* Event handler for selecting a tab
*/
Expand All @@ -22,4 +26,4 @@ export interface IIndexNavigationProps {
* Event handler for clearing the search query
*/
onSearchClear: () => void;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class IndexNavigation extends React.Component<IIndexNavigationProps, {}>
public render(): React.ReactElement<IIndexNavigationProps> {
// build the list of alphabet letters A..Z
const az = Array.apply(null, { length: 26 }).map((x: string, i: number): string => { return String.fromCharCode(65 + i); });
if (this.props.locale === "sv-SE") {
az.push('Å', 'Ä', 'Ö');
}
// for each letter, create a PivotItem component
const indexes: JSX.Element[] = az.map(index => <PivotItem linkText={index} itemKey={index} key={index} />);
// as the last tab in the navigation, add the Search option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export interface IPeopleDirectoryProps {
* be able to edit the page title or not.
*/
displayMode: DisplayMode;
/**
* Current locale
*/
locale: string;
/**
* Event handler for changing the web part title
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ export class PeopleDirectory extends React.Component<IPeopleDirectoryProps, IPeo
searchQuery={searchQuery}
onIndexSelect={this._handleIndexSelect}
onSearch={this._handleSearch}
onSearchClear={this._handleSearchClear} />
onSearchClear={this._handleSearchClear}
locale={this.props.locale} />
{loading &&
// if the component is loading its data, show the spinner
<Spinner size={SpinnerSize.large} label={strings.LoadingSpinnerLabel} />
Expand Down

0 comments on commit f7d7134

Please sign in to comment.