This was a really helpful test case because it revealed some bugs in how we read files.
--ignore-warnings flag. Wikipedia's warnings are all spurious.
Stop trying to do a 1:1 mapping of .strings files. Instead, combine all strings file values into a single list and compare the lists.
Support UTF-16 encoding by retrying file reading if the first read fails with a certain error.
Append problem kind to summary lines to make it easier to ignore specific things.
File-level errors are now reported in the summary instead of only in the line-by-line stderr errors.
Strip common prefix from summary when using discover* commands for readability
Example below. The errors aren't really errors for Wikipedia specifically, but I'm not comfortable downgrading them to warnings without a lot more thought, because these errors would really be errors in the Asana app. Looking at the actual strings, it appears they use a custom localization system, so I'm not worried about it.
> swift run locheck discoverlproj ~/dev/3p/wikipedia-ios/Wikipedia/iOS\ Native\ Localizations --ignore-warnings
Discovering .lproj files in /Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations with en as the base
Source of truth: /Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations/en.lproj/
Translations to check: 108
/Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations/eu.lproj/Localizable.stringsdict:22: error: 'article-deleted-accessibility-notification' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
/Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations/eu.lproj/Localizable.stringsdict:166: error: 'reading-lists-delete-reading-list-alert-title' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
/Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations/eu.lproj/Localizable.stringsdict:297: error: 'saved-unsave-article-and-remove-from-reading-lists-title' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
/Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations/ga.lproj/Localizable.stringsdict:6: error: 'article-deleted-accessibility-notification' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
/Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations/id.lproj/Localizable.stringsdict:6: error: 'aaald-characters-text-description' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
/Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations/nqo.lproj/Localizable.stringsdict:38: error: 'article-deleted-accessibility-notification' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
/Users/stevelandey/dev/3p/wikipedia-ios/Wikipedia/iOS Native Localizations/uk.lproj/Localizable.stringsdict:120: error: 'article-deleted-accessibility-notification' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
Summary:
eu.lproj/Localizable.stringsdict
article-deleted-accessibility-notification:
ERROR: 'article-deleted-accessibility-notification' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
reading-lists-delete-reading-list-alert-title:
ERROR: 'reading-lists-delete-reading-list-alert-title' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
saved-unsave-article-and-remove-from-reading-lists-title:
ERROR: 'saved-unsave-article-and-remove-from-reading-lists-title' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
ga.lproj/Localizable.stringsdict
article-deleted-accessibility-notification:
ERROR: 'article-deleted-accessibility-notification' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
id.lproj/Localizable.stringsdict
aaald-characters-text-description:
ERROR: 'aaald-characters-text-description' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
nqo.lproj/Localizable.stringsdict
article-deleted-accessibility-notification:
ERROR: 'article-deleted-accessibility-notification' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
uk.lproj/Localizable.stringsdict
article-deleted-accessibility-notification:
ERROR: 'article-deleted-accessibility-notification' has more arguments than the base language. Extra args: d (stringsdict_entry_has_too_many_arguments)
0 warnings, 7 errors
Errors found
This was a really helpful test case because it revealed some bugs in how we read files.
--ignore-warnings
flag. Wikipedia's warnings are all spurious..strings
files. Instead, combine all strings file values into a single list and compare the lists.discover*
commands for readabilityExample below. The errors aren't really errors for Wikipedia specifically, but I'm not comfortable downgrading them to warnings without a lot more thought, because these errors would really be errors in the Asana app. Looking at the actual strings, it appears they use a custom localization system, so I'm not worried about it.
Fix #18