Arm1.ru

Adding translations to an app or a package with AI help

Translated String Catalog

In the previous article, I've explained how to add a Strings Catalog to a Swift package to support localizations. Now, we'll try to translate it into more languages.

The Strings Catalog itself is just JSON internally. You can see it in Xcode by right-clicking on the file and selecting Open As → Source Code.

String Catalog source code

Now we can easily translate it into more languages with AI help. I played with Copilot and Gemini, and both work great. Here's an example with Copilot. Just paste that JSON and ask to add more languages:

Ask Copilot to add more languages

And here we go:

Copilot response

Just paste that JSON into the Strings Catalog source code, and you've got it translated.

Translated String Catalog

The Copilot dialog has some length limitations, so if you have a pretty long JSON, just split it into smaller chunks.

keyboard_return back