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

feat: Export description as comment for Android #2472

Closed

Conversation

vaclavsauer
Copy link

@vaclavsauer vaclavsauer commented Sep 19, 2024

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.

"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",
Copy link
Author

@vaclavsauer vaclavsauer Sep 19, 2024

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

@@ -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-->
Copy link
Contributor

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()) {
Copy link
Contributor

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.

@Anty0
Copy link
Collaborator

Anty0 commented Oct 10, 2024

Superseded by #2560

@Anty0 Anty0 closed this Oct 10, 2024
Anty0 added a commit that referenced this pull request Oct 14, 2024
Supersedes  #2472
Fixes  #2391 and  #2464

---------

Co-authored-by: Vašek <>
TolgeeMachine pushed a commit that referenced this pull request Oct 14, 2024
# [3.79.0](v3.78.4...v3.79.0) (2024-10-14)

### Bug Fixes

* Update redisson to 3.27.0 ([#2592](#2592)) ([24773bf](24773bf))

### Features

* export and import comments as description for Android XML ([#2560](#2560)) ([a4cb047](a4cb047)), closes [#2472](#2472) [#2391](#2391) [#2464](#2464)
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

Successfully merging this pull request may close these issues.

3 participants