Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String arrays with missing translations #12

Closed
paour opened this issue Feb 10, 2012 · 5 comments
Closed

String arrays with missing translations #12

paour opened this issue Feb 10, 2012 · 5 comments

Comments

@paour
Copy link

paour commented Feb 10, 2012

a2po exports an Android string array such as to keys like my_strings:1, etc.

If some of the strings in the string-array are not translated in some languages (for example, a new string is added to the array in the default language, but some of the translators haven't had a chance to translate it yet), when the array is imported back in to the Android xml, it will be missing some items for the affected languages, and if that array is used in a Preference, the Preference will be missing some items.

It would be better to either force the default values for the missing array items, or to fully remove the array from the Android xml if any item is missing.

@miracle2k
Copy link
Owner

Hm yes, so there actually exists an argument that makes the function in question include untranslated strings, but it's not used by default (and it would affect non-arrays as well). There is also a comment that I no longer understand.

I'll need to take a closer look. Using the default values for arrays generally seems easy enough to do, as long as the .po file contains the untranslated message. If the message is missing, i.e. the .po file is incomplete, then this is an impossible problem to solve right now, because the Import command would not have enough information (it doesn't know the maximum array length and does not look at the original file). Fortunately, that should rarely be the case.

At some point comments may possibly be used to encode additional information. This would solve a lot of these sorts of issues.

@timsu
Copy link

timsu commented Feb 29, 2012

Second this - arrays that are of the wrong size cause nasty bugs with android apps - and prevent strings files from being usable after a2po is finished with them :(

@paour
Copy link
Author

paour commented Feb 29, 2012

I've started using lint --check InconsistentArrays to make sure I don't have incomplete array translations... but lint has its own set of issues (it doesn't find all inconsistencies) and it would be better to fix at the source...

@paour
Copy link
Author

paour commented Aug 9, 2012

I'm not sure this was actually fixed. On 1.3.dev (latest git), when I try to import .po files with incomplete arrays, I have several problems: order is changed, and some incomplete arrays are still incomplete.

In my opinion, incomplete arrays should not at all be imported, or alternatively the missing strings should be replaced with the same string in the source language.

@miracle2k
Copy link
Owner

the missing strings should be replaced with the same string in the source language.

That's what it's supposed to do. Look at this test which is passing:

https://github.com/miracle2k/android2po/blob/master/tests/convert/test_string_arrays.py#L122

What is different in your case? I notice that in the test, both array items exist in the .po file, but one has no translations. There is no test for when one item has not occur in the .po file at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants