Page MenuHomePhabricator

Add special support for languages with 3-letter codes on Android
Closed, ResolvedPublic1 Estimated Story Points

Description

  1. Use the More Locale app to change the language code to 'sah'. (See http://ultimategerardm.blogspot.com/2012/02/trick-android-to-use-your-language.html )
  1. Look at the icon for the Wikipedia app. The title appears in the Devanagari script and the language is probably Sanskrit. The language is supposed to be Sakha and the script is supposed to be Cyrillic.
  1. Enter the app. The menus are in Sakha.

Version: Alpha
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:25 AM
bzimport set Reference to bz36264.
bzimport added a subscriber: Unknown Object (MLST).

After a bit of debugging, Android's build system does not like three letter code resource variants. Creating res/values-sah or res/values-bho or res/values-kbd fails, while res/values-bh works perfectly fine. I'm chalking this down to a bug in the Android build system, will look around to see if this has been reported already.

Thanks for looking into this, Yuvi. Please don't forget to add a link to the upstream bug report and the keyword "upstream" when the bug exists.

Keeping this bug around as a note to ourselves that we'll need to jump through a couple hoops to support some languages as UI languages on the new Android app.

Lowering the priority though, as UI language by default will be tied to system UI language which won't include those languages.

The upstream bug was fixed last February.

Is this already usable in the current development tools? If not, when can we expect a version that will support it?

We think the build system limitations are no longer present. We need to add the three letter language codes and test.

MBinder_WMF set the point value for this task to 1.May 18 2016, 7:51 PM

I'm actually a bit confused here: our static-data files (e.g. MainPageNameData.java) already contain plenty of three-letter language codes, implying that we've been able to support these languages in the app for a while now... but I don't see any three-letter resource subdirectories.
@Niedzielski @Nikerabbit Is this just a matter of opening up (enabling?) the sync of three-letter language translations from TWN? Any reason not to do this?

I would be more than happy to open up translation for them, but only if they actually work, to not waste translators time :)

I've just tested locally with a 3-letter language on Android 6 and 7, and it seems to work just fine. I will let @Niedzielski give the confirmation (since he's the one who performs the syncs with TWN, and may be aware of some other blocker), but I would say... go for it!

3 letter codes support is fixed in Android since 2014. Please, see these bug reports in Android Gerrit:
https://android-review.googlesource.com/#/c/82116/
https://android-review.googlesource.com/#/c/82117/

For reference, there is a blog post on how to add BCP47 support in Android apps:
http://connortumbleson.com/2015/04/10/apktool-fixing-bug-761/

This limitation predates my involvement with the app. No blockers on my end!

Let's go ahead, then! Sorry this fell off my radar until now.

Putting this in Tracking, and will resolve once @Nikerabbit enables 3-letter languages in TWN and we receive the first round of sync'd translations.

Change 314232 had a related patch set uploaded (by Nikerabbit):
Wikipedia Android: lift restriction to allow three letter language codes

https://gerrit.wikimedia.org/r/314232

Change 314232 merged by jenkins-bot:
Wikipedia Android: lift restriction to allow three letter language codes

https://gerrit.wikimedia.org/r/314232

Change 315285 had a related patch set uploaded (by Niedzielski):
WIP: Localisation updates from https://translatewiki.net.

https://gerrit.wikimedia.org/r/315285

Change 316587 had a related patch set uploaded (by Niedzielski):
Wikipedia Android: update language mappings

https://gerrit.wikimedia.org/r/316587

Change 316587 merged by jenkins-bot:
Wikipedia Android: update language mappings

https://gerrit.wikimedia.org/r/316587

Testing:

  1. Install MoreLocale 2
  2. From the command line, execute adb shell pm grant jp.co.c_lis.ccl.morelocale android.permission.CHANGE_CONFIGURATION
  3. Launch MoreLocale 2
  4. Tap custom locale
  5. Set language to "kk" and variant to "Cyrl"
  6. Tap set
  7. Launch the Wikipedia app

Testing on Wikipedia app build 2.4.180-alpha-2016-10-27 and Galaxy Express 3 (Android 6.0.1). As shown in the screencap below, language translation using the More Locale app appears to be fixed.

T38264 Galaxy SIII Android 6.0.1.png (800×480 px, 44 KB)

Dbrant claimed this task.

very happy to call this one done!