Text Localization
Sean343 opened this issue ยท 10 comments
Hi,
Is it possible to localise the text so that it supports multiple languages? I have a number of users from non-english speaking countries.
Hello, any update on it? I think this is one of the most important case in this project right now - if it is intendend to inform all EU users appropriately they should be given explenation in their language.
Edit the lib yourself, create html for each language see this line https://github.com/googleads/googleads-consent-sdk-android/blob/master/consent-library/src/main/java/com/google/ads/consent/ConsentForm.java#L271
I think this lib is not build for localization from the start. They use html, js technology for both Android and iOS
I think that native library/sdk should display also native dialog and not render html (with javascript and so one) instead.
Idea for a quick solution:
Probably it would be useful to exclude the path passed to webView.loadUrl() into a member variable which can be changed by setConsentFormUrl() or something like this to get multilanguage support without hacking the lib itself (I hate that! It breaks the ability to update).
Then we can have multiple variants of consentform.html in the asset folder.
I think a simple edit can support other language:
String countryiso3 = Resources.getSystem().getConfiguration().locale.getISO3Country();
this.webView.loadUrl("file:///android_asset/consentform_"+"countryiso3"+".html");
And then translate the html form for each language, put it in your asset folder and you are done
Here are 10 languages for which I have ordered a translation. The texts were translated by a translation team. I cannot guarantee the correctness of the translation.
Chinese (Simplified)
Dutch
French (France)
German
Italian
Japanese
Korean
Russian
Portuguese (Portugal)
Spanish (Spain)
In the file ConsentForm.java I changed the function load(). In the strings file I added a "consentform" string with the filename for for every language I use.
public void load() {
if (this.loadState == LoadState.LOADING) {
listener.onConsentFormError("Cannot simultaneously load multiple consent forms.");
return;
}
if (this.loadState == LoadState.LOADED) {
listener.onConsentFormLoaded();
return;
}
this.loadState = LoadState.LOADING;
// Codenia code
**this.webView.loadUrl("file:///android_asset/" + Helper.getLocalizedString(R.string.consentform) + ".html");**
//this.webView.loadUrl("file:///android_asset/consentform.html");
}
Thank you for sharing. I think that Chinese, Japanese, Korean and Russian should not be provided with library. As far as I know only for EEA (European Economic Area) countries this consent should be displayed. European Economic Area countries: https://europa.eu/european-union/about-eu/countries_en#tab-0-0
Yes, but in Europe there are many Chinese people who have set Chinese language on their smartphone or many Russians who have set Russian language. (And so on)
It make sense for me. But it is bad news.