Page MenuHomePhabricator

Android FFS doesn't support string-array
Open, NormalPublic

Description

Author: ciaran

Description:
Android XML string resources can contain string array declarations (with multiple translatable strings within) in addition to single strings. The current Android FFF read/writer doesn't support these - they're just skipped over.

I've implemented support for this on my installation - not especially elegantly, but it works. Patch to be attached...

Also requested for: https://translatewiki.net/wiki/Thread:Support/Project_MAXS

Details

Reference
bz56276

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 2:14 AM
bzimport set Reference to bz56276.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Oct 28 2013, 8:54 PM

ciaran wrote:

Patch to implement this

Attached:

On a quick look looks okay. Example (preferably in format of unit tests) would be nice.

ciaran wrote:

Proposed unit test

Ok, so I'm not set up to run these unit tests (in other words, I haven't tested it at all!) but it should look something like this patch.

Attached:

Change 98706 had a related patch set uploaded by Siebrand:
Add support for string arrays in AndroidXmlFFS

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

I've created gerrit 98706 out of this. Unit tests, etc, should be run automatically, so you can observe how it's doing...

In code review, I left a concern about what will happen with a partial translation of the string array elements. I think the code does not handle that correctly, and there's no test for it.

Ciaran, can you please reply to the open question? Otherwise we are not going to make progress here unfortunately...

ciaran wrote:

Apologies, I missed the notification on that one.

Yes, you're right, if only some elements in an array are translated in a particular language, you end up with an array that's not of the right length. You spotted it in code review, we spotted it when our app crashed trying to use a truncated array. ;)

The code we're running currently deals with this by keeping the translated elements and using the originals for the others.

I can submit a new patch for the updated code we're using now, but I guess I will need to add tests for it as well.

Change 98706 abandoned by Siebrand:
Add support for string arrays in AndroidXmlFFS

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

Nemo_bis updated the task description. (Show Details)Mar 18 2015, 11:36 AM
Nemo_bis set Security to None.

This might be easier to implement now with the new ArrayFlattener class. Some additional XML parsing & generation to go to/from PHP arrays is needed though.

Nikerabbit updated the task description. (Show Details)
Nikerabbit removed a subscriber: wikibugs-l-list.