Is there a Codable type that I can use to JSON decode and encode String Catalogs (xcstrings files), or do I need to roll my own?
(I'm thinking of making some small tooling related to xcstrings files.)
Is there a Codable type that I can use to JSON decode and encode String Catalogs (xcstrings files), or do I need to roll my own?
(I'm thinking of making some small tooling related to xcstrings files.)
None that I know of, which is why I created swift-string-catalogs.
Typical usage would be:
let decoder:JSONDecoder = JSONDecoder()
guard let data:Data = FileManager.default.contents(atPath: path) else {
return
}
let value:StringCatalog = try decoder.decode(StringCatalog.self, from: data)
I've been using it in production (on a Linux server) for months to localize https://litleagues.com (litleagues currently only supports English & Spanish, but swift-string-catalogs can support all languages that xcstrings supports).