Been trying to hand prune our localization files, but they have over 2k strings from over seven years. Tried this out and it didn't find anything abandoned.
Turns out contentsOfFile is reading the strings file using utf8 encoding and our files are utf16. This causes the try to fail and an empty string returned instead of file contents.
Found something mentioned on SO that as of 2016 Apple is using utf8, but a new localization I created yesterday is utf16 as well.
Same issue. For me I replaced
return try String(contentsOfFile: filePath, encoding: String.Encoding.utf8)
with
return try String(contentsOfFile: filePath)
Been trying to hand prune our localization files, but they have over 2k strings from over seven years. Tried this out and it didn't find anything abandoned.
Turns out contentsOfFile is reading the strings file using utf8 encoding and our files are utf16. This causes the try to fail and an empty string returned instead of file contents.
Found something mentioned on SO that as of 2016 Apple is using utf8, but a new localization I created yesterday is utf16 as well.
Maybe consider a warning in contentsOfFile catch?