diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2016-12-29 21:24:46 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2016-12-29 21:24:46 -0800 |
commit | 6220fd7da99b2edf6b1c6e98e65b45216a32e7af (patch) | |
tree | fbb5c8fe99671d43a89976f69586924d92cbc27d | |
parent | 8bd55062b41bb5598bba59417a90b57e720d3e9b (diff) |
Apparently, setlocale never actually did anything.v1.1.28%b2
-rw-r--r-- | MobileCydia.mm | 43 | ||||
m--------- | apt | 0 |
2 files changed, 23 insertions, 20 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index d25e070..2a694ee 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -10304,29 +10304,28 @@ int main(int argc, char *argv[]) { Locale_ = CFLocaleCopyCurrent(); Languages_ = [NSLocale preferredLanguages]; - //CFStringRef locale(CFLocaleGetIdentifier(Locale_)); - //NSLog(@"%@", [Languages_ description]); + std::string languages; + const char *translation(NULL); - const char *lang; + // XXX: this isn't really a language, but this is compatible with older Cydia builds if (Locale_ != NULL) - lang = [(NSString *) CFLocaleGetIdentifier(Locale_) UTF8String]; - else if (Languages_ != nil && [Languages_ count] != 0) - lang = [[Languages_ objectAtIndex:0] UTF8String]; - else - // XXX: consider just setting to C and then falling through? - lang = NULL; - - if (lang != NULL) { - RegEx pattern("([a-z][a-z])(?:-[A-Za-z]*)?(_[A-Z][A-Z])?"); - lang = !pattern(lang) ? NULL : [pattern->*@"%1$@%2$@" UTF8String]; - } + if (const char *language = [(NSString *) CFLocaleGetIdentifier(Locale_) UTF8String]) { + RegEx pattern("([a-z][a-z])(?:-[A-Za-z]*)?(_[A-Z][A-Z])?"); + if (pattern(language)) { + translation = strdup([pattern->*@"%1$@%2$@" UTF8String]); + languages += translation; + languages += ","; + } + } - NSLog(@"Setting Language: %s", lang); + if (Languages_ != nil) + for (NSString *language : Languages_) { + languages += [language UTF8String]; + languages += ","; + } - if (lang != NULL) { - setenv("LANG", lang, true); - setlocale(LC_ALL, lang); - } + languages += "en"; + NSLog(@"Setting Language: %s", languages.c_str()); /* }}} */ /* Index Collation {{{ */ if (Class $UILocalizedIndexedCollation = objc_getClass("UILocalizedIndexedCollation")) { @try { @@ -10577,7 +10576,11 @@ int main(int argc, char *argv[]) { _config->Set("Dir::Bin::Methods::store", "/Applications/Cydia.app/store"); _config->Set("pkgCacheGen::ForceEssential", ""); - _config->Set("APT::Acquire::Translation", "environment"); + + if (translation != NULL) + _config->Set("APT::Acquire::Translation", translation); + if (!languages.empty()) + _config->Set("Acquire::Languages", languages); // XXX: this timeout might be important :( //_config->Set("Acquire::http::Timeout", 15); diff --git a/apt b/apt -Subproject 1242b3bdaf3d3682a945f10f0e537bdb3b0599d +Subproject 22c5f99a6119eeef30e1ddee3262bc942d05545 |