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

Android format: Strings with "xliff" tag not imported fine #628

Closed
ignaciogs opened this issue Dec 29, 2016 · 6 comments
Closed

Android format: Strings with "xliff" tag not imported fine #628

ignaciogs opened this issue Dec 29, 2016 · 6 comments
Assignees
Labels
[Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature is broken.
Milestone

Comments

@ignaciogs
Copy link
Contributor

Example in android format:

My name is "<xliff:g id="name" example="John">%s</xliff:g>".

is imported as:

My name is "".

@ocean90 ocean90 added the [Type] Bug An existing feature is broken. label Jan 10, 2017
@ocean90
Copy link
Member

ocean90 commented Jan 10, 2017

Hello @ignaciogs, thanks for the report.

Can you provide some details/docs about this tag? The Android format supports only strings in a format like https://github.com/wordpress-mobile/WordPress-Android/blob/develop/WordPress/src/main/res/values/strings.xml is.

@ignaciogs
Copy link
Contributor Author

Hi, This is the android documentation
https://developer.android.com/distribute/tools/localization-checklist.html
see the "Mark message parts that should not be translated" section please

@toolstack toolstack added the [Status] In Progress Tracking issues with work in progress label Jan 14, 2017
@toolstack toolstack added this to the 2.3 milestone Jan 14, 2017
@toolstack toolstack self-assigned this Jan 14, 2017
@toolstack
Copy link
Contributor

This is caused by the simplexml parser parsing the xliff:g tag during import and we then do not look for it.

I've created a PR that resolves it by encapsulating the tag inside of a CDATA structure and enabling simplexml's option to ignore CDATA tags.

@ocean90 ocean90 modified the milestones: 2.3, Future Jan 17, 2017
@pdalfarr
Copy link

pdalfarr commented Feb 10, 2017

Confirming this issue:
<xliff:g id="mail_account" example="first.last@gmail.com">%s</xliff:g> is not taken into account and is lost :-(
(%s disappeared: when I download the translation, the whole "<xliff:g id="mail_account" example="first.last@gmail.com">%s</xliff:g>" is not in the file anymore

When will your fix be available?
(I installed GlotPress using standard WordPress plugin system, i.e., install plugin from within WordPress admin panel)

Thanks for this amazing work!

Note: Some (humble) thoughts

In the example I gave, please note that xliff:g xml node give translators a hint about the value of '%s'. This is useful to help translator to understand the context of the text to be translated. Displaying this info in UI (if not too difficult for you) would really be useful!

So, when encountering this:
"Google account <xliff:g id="mail_account" example="first.last@gmail.com">%s</xliff:g>selected"
It could be handled like this:

  • in the left (source) translation panel:
    "Google account %s selected" (now %s is a "link" or, at least is displayed in some other way)
    when link is hovered, user could see:
  • Right Panel:
    will keep on displaying as now, i.e.:
    "Google account %s selected" (no changes)
    and just make a check (obvious) that %s is still in translated text (then replaced by original xliff node when exporting)

@toolstack
Copy link
Contributor

@pdalfarr doing a hover is very complex and probably needs some thought put behind it to handle all types of formats that might have this kind of requirement.

However I have updated the PR to handle them better by using the comment area to let the translator know what should not be edited.

@pdalfarr
Copy link

Your solution with comment area is great ! Thanks

@toolstack toolstack modified the milestones: 2.4, Future Feb 14, 2017
@toolstack toolstack modified the milestones: 3.0, 2.4 Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature is broken.
Projects
None yet
Development

No branches or pull requests

4 participants