The Terms of Service URL we use (Me > App Settings > WordPress for Android > Terms of Service) is hardcoded to en.wordpress. Translated versions of that page exist for several languages - we should use those where possible.
Do you know if all that's required is to send the locale param @aforcier?
@elibud from my checks it doesn't look like it, we'd have to store a list of all the valid locale subdomains on WordPress.com and use the [locale].wordpress.com/tos URL if we know the subdomain exists (otherwise use en.wordpress.com).
I'll check with i18n and see if there actually is a clever way to do this with a param.
Pinging @akirk as he may know the path forward, also once we have a solution lets fix it in iOS too.
@loremattei created an issue for iOS here: https://github.com/wordpress-mobile/WordPress-iOS/issues/9824
We can do a link like https://wordpress.com/tos/?lang=
What are common language slugs in Android? On WordPress.com we currently have these defined:
fresdeitherujapt-brnlkotridzh-cnzh-twarsvIf different ones are used in the app we'll need to do some rewriting, so it would be great if you could list out/compare them with the ones used in Android.
@akirk the language slugs we send to the WordPress.com API have this format:
fr_FR
he_IL
ja_JP
pt_PR
zh_CN
zh_TW
(ISO 639-1 lowercase language code, underscore, uppercase ISO 3166-1-alpha-2 (I believe) region code).
I think the WordPress.com API is pretty permissive (with some endpoints being exceptions IIRC) and accepts a few formats, since I see that Calypso seems to use the format in your examples.
We can do something different from the app for the TOS (and any other future calls like this) and just use the first (language) part, with a few hardcoded exceptions for pt-br, zh-cn, and zh-tw, but perhaps we can move that logic to the server and have it share the same handling that the rest of the WordPress.com API does - do you think that would be doable?
Ok great. In the spirit of supporting the same slugs as the API, we'll also use the parameter ?locale= which will accept the same slugs.
So https://wordpress.com/tos/?locale=ja_JP will redirect to https://ja.wordpress.com/tos/ and https://wordpress.com/tos/?locale=pt_BR will redirect to https://br.wordpress.com/tos/ etc.
Also, https://wordpress.com/tos/?locale=nl_BE will redirect to https://nl.wordpress.com/tos/ but https://wordpress.com/tos/?locale=te_IN won't redirect because we don't have the TOS in Telugu.
Are those URLs working already @akirk?
Hey @akirk, I'm "groundskeeper" this week and was wondering about tackling this on the Android side. What's the status of that API change?
Hi, sorry this has fallen off my plate. I had implemented this in D16387-code but received quite some pushback on doing the locale mapping server-side. Could we do the mapping for the locale codes we have on WordPress.com in the Android app?
@akirk just to make sure I follow your meaning - you're proposing we still add server-side support for requests of type https://wordpress.com/tos/?lang=, but that it only accepts the language codes of the kind you outlined in your comment you linked to - is that correct?
If that's the case, we can certainly do that - but could you share some detail on what the arguments were? That is, what's the reasoning against aligning the TOS URL requests with the locale format the WordPress.com API expects?
Yes, please map them to the locale codes I mentioned above. I am not aware of the WordPress.com API supporting other locale codes, are you sure?
Yes, please map them to the locale codes I mentioned above. I am not aware of the WordPress.com API supporting other locale codes, are you sure?
Followed up over chat, with the notifications endpoint as an example that handles locale=xx_YY requests.
Sorry for the super long delay but this has now landed, so redirects like https://wordpress.com/tos/?locale=zh_CN work.
Thank you @akirk
@aforcier can you check that is working on Android and have someone double check in iOS please?
Nice @akirk! Tested the redirects a bit, seems to be working well.
I'll work on patching the app to append the parameter to the ToS URL requests.
Most helpful comment
Sorry for the super long delay but this has now landed, so redirects like https://wordpress.com/tos/?locale=zh_CN work.