weblate
weblate copied to clipboard
<xliff:g> placeholder tag in Android string xml does not seem to be supported
Describe the issue
https://developer.android.com/guide/topics/resources/localization#mark-message-parts
Mark message parts that should not be translated
Often strings contain text that should not be translated into other languages. Common examples might be a piece of code, a placeholder for a value, a special symbol, or a name. As you prepare your strings for translation, look for and mark text that should remain as-is, without translation, so that the translator doesn't change it.
To mark text that should not be translated, use an xliff:g placeholder tag. Here is an example tag that ensures the text "%1$s" isn't changed during translation (otherwise it could break the message):
<string name="countdown"> <xliff:g id="time" example="5 days">%1$s</xliff:g> until holiday </string>
I followed the document to add xliff tags to my strings.xml, however in weblate, it displays the tag directly.
Android string XML: https://github.com/RikkaApps/WADB/commit/21aa666e25fff327692563766904d1ca69eb22b1
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="translation_contributors">The translation is contributed by <xliff:g id="translator_names">%1$s</xliff:g>.</string>
<!-- ...-->
<string name="open_source_info">This software is open source (<xliff:g id="github_url">%1$s</xliff:g>) under <xliff:g id="license_name" example="Apache License 2.0">%2$s</xliff:g>.</string>
Weblate project for this issue: https://hosted.weblate.org/translate/wadb/application/zh_Hans/?checksum=f73c41765043693f
I already tried
- [X] I've read and searched the documentation.
- [X] I've searched for similar issues in this repository.
Steps to reproduce the behavior
- Add some xliff tags for Android string xml
- Check weblate
- See the "error"
Expected behavior
Weblate displays xliff tags as some sort of comment instead of displaying the tag directly.
Screenshots
Exception traceback
No response
How do you run Weblate?
weblate.org service
Weblate versions
No response
Weblate deploy checks
No response
Additional context
No response
Weblate highlights the placeholder tags. You can click on them to insert them to the translation.
It may be more confusing for non-technical translators if the tags are displayed directly. I hope that Weblate can display the tag in a more user-friendly format. For example, <xliff:g id="license_name" example="Apache License 2.0">%2$s</xliff:g>
is displayed as %2$s (license_name, example: Apache License 2.0)
, click on it only inserts %2$s
.
This issue has been automatically marked as stale because there wasn’t any recent activity.
It will be closed soon if no further action occurs.
Thank you for your contributions!
This issue has been added to the backlog. It is not scheduled on the Weblate roadmap, but it eventually might be implemented.
In case you need this feature soon, please consider helping or push it by funding the development.