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: Apple String Catalog Support #2893

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

feat: Apple String Catalog Support #2893

wants to merge 7 commits into from

Conversation

neo773
Copy link

@neo773 neo773 commented Feb 4, 2025

This PR adds support for Apple String Catalog Support

demo

a.mp4

/claim #2300
/closes #2300

@neo773 neo773 marked this pull request as ready for review February 4, 2025 17:25
@neo773
Copy link
Author

neo773 commented Feb 4, 2025

@JanCizmar Hi, this is ready to be reviewed

@JanCizmar
Copy link
Contributor

Impressive job! I am reviewing it now.

@JanCizmar JanCizmar self-requested a review February 5, 2025 08:50
@ftp27
Copy link

ftp27 commented Feb 5, 2025

I believe it should use the key as the original translation. Additionally, it doesn't recognize some format specifiers and eventually breaks them during export. Here is the export result. English was the original language for the file, by the way.
image

@neo773
Copy link
Author

neo773 commented Feb 5, 2025

Will look into it, thanks!

@Test
fun `returns correct parsed result`() {
processFile()
mockUtil.fileProcessorContext.assertLanguagesCount(2) // en, fr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see that by default it converts %@ and %lld parameters into the Tolgee Universal ICU format by default. Please add such params to the example files and test them.

.assertSinglePlural {
hasText(
"""
{value, plural,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we also need to test what happens when there is some ICU syntax by any chance in the string. Such syntax has to be escaped.

This is tested here:
io.tolgee.unit.formats.apple.in.StringsdictFormatProcessorTest#import with placeholder conversion (disabled ICU)

@JanCizmar
Copy link
Contributor

It also looks like the exported json is not formatted.

@JanCizmar
Copy link
Contributor

JanCizmar commented Feb 5, 2025

@ftp27 I believe you are using it wrong. You have to enable the conversion to Tolgee ICU placeholders when importing or you need to disable ICU support on the project configuration level.

It seems like you have the ICU support enabled, but you turned off the conversion when importing. This leads to escaped % sign when exporting so %@ goes to %%@.

More context here:

https://docs.tolgee.io/platform/formats/apple_strings
https://docs.tolgee.io/platform/projects_and_organizations/import#importing-placeholders
https://docs.tolgee.io/platform/translation_process/tolgee_universal_icu_placeholders

@JanCizmar
Copy link
Contributor

I have prepared PR to docs and CLI:
tolgee/documentation#841
tolgee/tolgee-cli#153

@JanCizmar
Copy link
Contributor

To make ktlint pass, you need to run ./gradlew ktlintFormat task.

@neo773
Copy link
Author

neo773 commented Feb 5, 2025

@JanCizmar
Hi,

Sorry about that, pushed new changes.

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

Successfully merging this pull request may close these issues.

Feature Request: Apple String Catalog Support
4 participants