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

Add support for Apple String Catalogs #5190

Open
mangerlahn opened this issue Feb 16, 2024 · 3 comments
Open

Add support for Apple String Catalogs #5190

mangerlahn opened this issue Feb 16, 2024 · 3 comments
Labels

Comments

@mangerlahn
Copy link

mangerlahn commented Feb 16, 2024

Apple introduced a new format for storing localizations in 2023. A string catalog (.xcstrings) is a single file containing localizations, including plurals, for multiple languages. The format is based on JSON. I was not able to find a spec online, but there is a session explaining how to work with these files. It may also be that Apple considers this format private, as they advertise using .xliff files when exporting the localized strings. What do you think?

Brought over from Weblate: WeblateOrg/weblate#10848

@mangerlahn
Copy link
Author

Apple also updated their identifiers for plurals in .xliff files. Plus, they added syntax for conditionals to provide additional strings under certain conditions like device type etc.. These changes to xliff files apply only when String Catalog files are used within Xcode. I believe both types of syntax can occur within one xliff file. More at 23:30 in the above mentioned session.

@nijel
Copy link
Member

nijel commented Feb 19, 2024

It's always annoying to implement support for a format that is not documented. We can definitely look for existing examples (like https://github.com/liamnichols/xcstrings-tool-demo/blob/main/DogTracker/Localizable.xcstrings), but that doesn't have to cover all the features and might be fragile. If the format is desired for interoperability, having a JSON schema for it would be the best approach.

The good thing on using the XLIFF ids is that the XLIFF file will just work (similar to #4614). The only drawback is that the plural forms will be shown as individual forms instead of as a plural forms of a single string.

@nijel
Copy link
Member

nijel commented Feb 19, 2024

Quoting https://forums.developer.apple.com/forums/thread/732120?answerId=756602022#756602022:

As for the specifics of the JSON format itself, we have not published documentation because it is primarily intended to be read/written by Xcode. If you do end up writing your own parser for this format, please be aware that Xcode reserves the right to change it.

So they apparently consider the format private and will not be helpful. Still, from a Weblate perspective, it might be useful to support it.

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

No branches or pull requests

2 participants