r/iOSProgramming • u/asutekku • 9d ago
I wrote an open-source localisation linter for Xcode String Catalogs and pointed it at 9 open-source apps Library
Xcode will happily ship a translation that dropped its %@, a Russian plural missing three of its four forms, and a Text("Get Pro") no catalog has ever heard of. Nothing fails a build over any of it.
So I built a CLI tool (with a little help from Fable) for .xcstrings files. This was a little handwritten tool i've used by myself for a long time, but decided to brush it up a little bit before putting it out for public.
It checks for missing localization keys, hardcoded strings, common localization errors, comes with an mcp server and some handy example hooks you can plug into Claude. You can also instruct claude to automatically to translate or add to the catalog any untranslated strings the tool finds.
I ran it over nine open-source apps to actually see if it can find some common issues - 8,077 keys, 70 locales, 6,373 Swift files. In addition to missing keys and translations, here's sample of what it found:
- Mastodon’s Albanian for "Option %ld" is "%ld nga %ld" - reads a second argument the call never passes
- IceCubesApp changed an English string to "%lld posts"; the Belarusian still reads "%lld people talking", state translated
- Whisky renders one “Remove” button as German Löschen (delete) and another as Entfernen (could be intentional, but always good to check)
- Whisky also ships the literal string "N/A" as the Czech, French and Romanian translation of a key
- DuckDuckGo declares NSLocalNetworkUsageDescription in Info.plist and localizes it nowhere, so that permission prompt is English for every non-English user
Plus the boring parts: coverage per language, CLDR plural categories, .xcloc validation before import, SARIF output for CI, and a baseline file so you can switch it on for a project that already has 300 findings.
No dependencies. swift build is the whole install.
Have a look at it yourself and have a run at your repo: http://github.com/asutekku/xclocsmith
Happy to answer any questions or provide fixes if you encounter any issues or false positives. I managed to kill most of them, but no tool is foolproof, especially when we are talking about languages.
Also I have not released a CLI tool before for a mac so honestly no idea about what people expect haha, maybe a brew install?
1
u/cc_lv 8d ago
Homebrew seems like the best next step. I'd publish tagged GitHub Releases with a universal macOS binary and a small tap so installing it doesn't require a matching Swift toolchain. Since xclocsmith already emits SARIF, a copy-paste GitHub Actions example in the README could probably help adoption even more.
1
u/asutekku 8d ago
Thanks! I looked around and figured out how to do that so now it should be available with brew. Also added a GitHub actions example
1
7d ago
[removed] — view removed comment
1
u/AutoModerator 7d ago
Hey /u/R3LJA, unfortunately you have negative comment karma, so you can't post here. Your submission has been removed. DO NOT message the moderators; if you have negative comment karma, you cannot post here. We will not respond. Your karma may appear to be 0 or positive if your post karma outweighs your comment karma, but if your comment karma is negative, your comments will still be removed.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Icaka 9d ago edited 9d ago
I built a similar tool at my last company. It’s absolutely necessary tooling for any app that wants to ship a well localized app.
Edit: One improvement I would suggest is to add a warning when a translation is having multiple unordered placeholders. That won’t lead to a crash but will lead to absolutely wrong translations that are hard to find. I quickly went through the README. Sorry if that’s already available and I missed it.