As the Office store now supports a Dutch version that allows for Dutch apps. App localization just got a little more interesting.It might be a good idea to localize your apps when you are creating Apps for SharePoint. As without localizing your apps there will be a risk when deploying them on other tenants or site configurations. While the title and description might be readable for your users as they will be English, retrieving or storing information on the host web might could potentially be in another language.
SharePoint elements & Localization
When you are localizing host web components you can easily resort to resource files and call them using replacement parameters in your elements, like the following example:
<ListInstance Title="$Resources:OrdersListInstance_Title" OnQuickLaunch="TRUE" TemplateType="10000" Url="Lists/Orders" Description="$Resources:OrdersListInstance_Description"> </ListInstance>
Unfortunately the default Language parameter that can be passed as query string by your app is the culture info, and not the LCID. So if you want to use your LCID and load the correct script you will need to get the Language from the core resource with the following snippet:
Once that script is loaded you can call the strings you need, as it creates a new object called Strings that contains an object STS, and that will provide the strings you need.
In our case we used Strings.STS.L_BlogPostFolder, so we can easily do a REST call to retrieve the blog list based on the localized title, as that differs between different languages. That way whether you install your app in a Dutch or an English environment and still execute the following REST query
url: "https://maventionurl/_api/SP.AppContextSite(@target)/web/lists/ GetByTitle('" + Strings.STS.L_BlogPostFolder + "')
Without applying localization in your scripts calling out of the box lists through REST will be painfully as you will have to do the localization yourself.