Enabling Multilingual/Localization in SharePoint Framework Client Side Webparts

Check the below steps for adding multiple language in SharePoint Framework(SPFx) webparts:

1. Within "loc" folder you will see a file named "mystrings.d.ts". At first add property here like below:

declare interface ITestWebPartStrings {
    WebpartTitle: string;
}

2. There is a file for english language named "en-us.js". If you want to
add another language you have to create another file. For example if
you want to add Norwegian language then you have to create "nb-NO.js" file.


3. After that add the property in "nb-NO.js" file for Norwegian language.
And for english language add property within "en-us.js" file as like below:

define([], function() {
    return {
        "WebpartTitle": "YourTitle",
    }
});

4. Now you have to import in your file.

import * as strings from 'TestWebPartStrings';

5. Now you can show "WebpartTitle" using "strings.WebpartTitle". This is the process to add multiple language.

let wpTitle = strings.WebpartTitle;

References from Microsoft documentation: Localize SharePoint Framework client-side web parts

If you want to do custom work you can place an order here:
https://www.fiverr.com/nizam5567
https://www.upwork.com/freelancers/nizamuddin

Leave your comment