-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
feat: Export description as comment for Android #2472
feat: Export description as comment for Android #2472
Conversation
"I am not just a percent {name} % sign!", | ||
keyName = "percent and placeholders", | ||
text = "I am not just a percent {name} % sign!", | ||
description = "This is a description", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to do this this way insted of
{
key.description = "Description"
}
Is it OK?
See additional change in ExportTranslationView
backend/data/src/main/kotlin/io/tolgee/service/export/dataProvider/ExportTranslationView.kt
Show resolved
Hide resolved
@@ -23,8 +23,9 @@ class AndroidXmlFileExporterTest { | |||
|<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | |||
| <string name="key1">Ahoj! I%d, %s, %e, %f</string> | |||
| <string name="percent_no_placeholders">I am just a percent \% sign!</string> | |||
| <string name="percent_and_paceholders">I am not just a percent %s %% sign!</string> | |||
| <string name="percent_and_paceholders_and_tags"><![CDATA[I am not just a percent <b>%s</b> %% sign!]]></string> | |||
| <!--This is a description--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're testing only the plain string comment, but not plural and string array item.
@@ -25,6 +21,10 @@ class AndroidStringsXmlFileWriter(private val model: AndroidStringsXmlModel) { | |||
private fun Element.addToElement(unit: Map.Entry<String, AndroidXmlNode>) { | |||
when (val node = unit.value) { | |||
is StringUnit -> { | |||
val comment = node.comment | |||
if (!comment.isNullOrEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wold be great to Create a private extension function Element.comment, which will add the comment only if it's not null to remove the deduplicate the duplicated null checking logic.
Superseded by #2560 |
Implementation of #2391
I'm not sure if tests are OK. A lot of them failed because there is a difference in line endings on windows.