Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output is broken if you have a NSLocalizedString with an empty string. #11

Open
Olof-IL opened this issue Dec 17, 2014 · 1 comment
Open

Comments

@Olof-IL
Copy link
Contributor

Olof-IL commented Dec 17, 2014

Description:
It seems Localized.strings must never contain a row like this:

"" = "";

If it does, the localization tables will mess up, and the application will complain it does not find strings in Foundation framework.

App warning looks like this:
Localizable string "(A Document Being Saved By %@)" not found in strings table "Document" of bundle CFBundle 0x12e508f60 </System/Library/Frameworks/Foundation.framework>
(need to have -NSShowNonLocalizedStrings YES as startup argument to enable the warning)

The original genstrings tool will not include empty strings, but output a warning.
DTLocalizableStringScanner unfortunately does include the empty string, and thus, the output is broken.

Proposed fix:
Make sure empty strings are never included in the output.

This can be done by adding:
if([key compare:@""""] == NSOrderedSame) {
continue;
}

in the for-loop in [DTLocalizableStringTable stringRepresentationWithEncoding], but there are probably better ways to do it :)

@odrobnik
Copy link
Collaborator

@Olof-IL how about putting this in a pull request.

Personally I'd do

if (![key length]) ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants