Introduction
Localization is nowadays one of the most important things when developing a solution. Since not everyone knows English it is worth to support multiple languages. But to test this can require some settings change in our browser or in the account, right? Wrong. There are a couple of ways to test your localization without having to update your settings.
Solution 1: query string
If you are using gulp serve
to test a web part, there’s a simple and convenient way to force the localization without having to update settings and that’s the query string.
In the workbench page we can attach the forceLocale
parameter to the query string to instruct the workbench about what locale we want to use.
For example, if you want to load the italian localization, you can use the following parameter and value:
forceLocale=it-it
And voilà! You have your UI localized!
Solution 2: gulp serve
If you don’t like the previous solution there’s another solution possible and that’s updating your gulp serve
command. The gulp serve
command accept a parameter locale
which accepts the localization you want to be used when serving the solution.
Sticking with italian, you can update your gulp serve
command as following:
gulp serve --nobrowser --locale it-it
Keep in mind that, if you use the
gulp serve
command, it will prevail over the query string.
Conclusions
Localization is a great feature for users and, in my opinion, it should be always implemented. With the two solutions above it becomes faster and easier to test that every localized string is set properly and behave correctly in the UI.
Hope this helps!
Top comments (0)