Forum Discussion
Programmatically receive the title of the list in the language of the browser in the SPFx
- Sep 29, 2021
MartinLaplante thank you for your answer.
I can change the list title in the navigation so, that I remove the navigation and set it back again.
But the list title changes in both languages after the change of the list title in one language.
So I can not set a different list title for a list just through changing the language and changing the list title.
Through this action I change the list title in all languages.
This is different behavior to SharePoint On Premise.
And in my point of view it is a bug.
LadislavStupak It's better to retrieve the list by its GUID. After you look it up you can use calls like
_api/web/lists('<list GUID>')
Otherwise, if you use /_api/web/lists/getbytitle('<list title>') the list title depends on the current language of the user that is executing the code. That can depend on the user's profile, or if the profile is blank it depends on the user's browser language setting.
In CSOM you can often retrieve the title in another language by using
splist.TitleResource.GetValueForUICulture(culture);
There is no complete solution yet, any time that you use the list title, you are taking a risk that it will only work in one language
MartinLaplante thank you for your message.
You are right about to better work with the ID of the list than with the title.
I have changed the language of my Office 365 account from English to German.
Then I have changed the title of the list.
Then I have changed the language of my Office 365 account back to Englisch.
The title of the list has been changed also in the Englisch language to the title like I have set in the German language.
But the Link in the vertical navigation remained in the English language.
So the behavior of changing the language of a list in SharePoint Online is different than in SharePoint On Premise.
I would say it is a bug.
- MartinLaplanteSep 28, 2021Iron Contributor
LadislavStupak I think the difference that you saw has to do with the order in which the steps were carried out, not a difference between on premise and online. Both the list name and the Navigation node support MUI, but they are separate objects, updating one does not update the other. If you add a list to the navigation then provide a German translation of the list name, that German translation is not automatically applied to the navigation entry. You have to edit the navigation entry as well while your language is German.
- LadislavStupakSep 29, 2021Brass Contributor
MartinLaplante thank you for your answer.
I can change the list title in the navigation so, that I remove the navigation and set it back again.
But the list title changes in both languages after the change of the list title in one language.
So I can not set a different list title for a list just through changing the language and changing the list title.
Through this action I change the list title in all languages.
This is different behavior to SharePoint On Premise.
And in my point of view it is a bug.
- LadislavStupakNov 30, 2022Brass ContributorI have tested now the behavior again.
Now it is working correctly.
When I change the title of a list in one language, the navigation displays the value in this new language.
When I change the language back to original language, then also the navigation is displayed in the original language.