2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

fixed new langs for os x

This commit is contained in:
John Preston
2014-12-18 23:15:58 +03:00
parent 06dccb468e
commit f6e15c1d37
3 changed files with 24 additions and 19 deletions

View File

@@ -173,7 +173,7 @@ void readKeyValue(const char *&from, const char *end) {
i = tags.insert(tagName, tagsOrder.size());
tagsOrder.push_back(tagName);
}
if (0x0020 + *i > 0x00F7) throw Exception(QString("Too many different tags in key '%1'").arg(QLatin1String(varName)));
if (0x0020 + *i > 0x007F) throw Exception(QString("Too many different tags in key '%1'").arg(QLatin1String(varName)));
QString tagReplacer(4, TextCommand);
tagReplacer[1] = TextCommandLangTag;
@@ -266,7 +266,7 @@ QString escapeCpp(const QByteArray &key, QString value, bool wideChar) {
res.reserve(value.size() * 10);
bool instr = false;
for (const QChar *ch = value.constData(), *e = value.constData() + value.size(); ch != e; ++ch) {
if (ch->unicode() > 0x00F7) {
if (ch->unicode() > 0x007F) {
if (instr) {
res.append('"');
instr = false;
@@ -300,7 +300,7 @@ QString escapeCpp(const QByteArray &key, QString value, bool wideChar) {
}
} else if (ch->unicode() < 0x0020) {
if (*ch == TextCommand) {
if (ch + 3 >= e || (ch + 1)->unicode() != TextCommandLangTag || (ch + 2)->unicode() > 0x00F7 || (ch + 2)->unicode() < 0x0020 || *(ch + 3) != TextCommand) {
if (ch + 3 >= e || (ch + 1)->unicode() != TextCommandLangTag || (ch + 2)->unicode() > 0x007F || (ch + 2)->unicode() < 0x0020 || *(ch + 3) != TextCommand) {
throw Exception(QString("Bad value for key '%1'").arg(QLatin1String(key)));
} else {
res.append('\\').append('x').append(QString("%1").arg(ch->unicode(), 2, 16, QChar('0')));

View File

@@ -70,9 +70,6 @@ private:
QNSString objc_lang(LangKey key) {
return QNSString(lang(key));
}
QNSString objc_lang(LangKey key, LangTag tag1, const QString &replacement1 {
return QNSString(lang(key, tag1, replacement1));
}
QString objcString(NSString *str) {
return QString::fromUtf8([str cStringUsingEncoding:NSUTF8StringEncoding]);
}
@@ -532,7 +529,7 @@ void objc_openFile(const QString &f, bool openwith) {
[button setFrame:alwaysRect];
[button setAutoresizingMask:NSViewMinXMargin|NSViewMaxXMargin];
NSTextField *goodLabel = [[NSTextField alloc] init];
[goodLabel setStringValue:objc_lang(lng_mac_this_app_can_open, lngtag_file, objcString(name)).s()];
[goodLabel setStringValue:QNSString(lng_mac_this_app_can_open(lt_file, objcString(name))).s()];
[goodLabel setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[goodLabel setBezeled:NO];
[goodLabel setDrawsBackground:NO];
@@ -545,7 +542,7 @@ void objc_openFile(const QString &f, bool openwith) {
[goodLabel setFrame:goodFrame];
NSTextField *badLabel = [[NSTextField alloc] init];
[badLabel setStringValue:objc_lang(lng_mac_not_known_app, lngtag_file, objcString(name)).s()];
[badLabel setStringValue:QNSString(lng_mac_not_known_app(lt_file, objcString(name))).s()];
[badLabel setFont:[goodLabel font]];
[badLabel setBezeled:NO];
[badLabel setDrawsBackground:NO];
@@ -575,7 +572,7 @@ void objc_openFile(const QString &f, bool openwith) {
[openPanel setAllowsMultipleSelection:NO];
[openPanel setResolvesAliases:YES];
[openPanel setTitle:objc_lang(lng_mac_choose_app).s()];
[openPanel setMessage:objc_lang(lng_mac_choose_text, lngtag_file, objcString(name)).s()];
[openPanel setMessage:QNSString(lng_mac_choose_text(lt_file, objcString(name))).s()];
NSArray *appsPaths = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationDirectory inDomains:NSLocalDomainMask];
if ([appsPaths count]) [openPanel setDirectoryURL:[appsPaths firstObject]];
@@ -655,7 +652,7 @@ BOOL _execUpdater(BOOL update = YES) {
[args addObject:QNSString(cDataFile()).s()];
}
DEBUG_LOG(("Application Info: executing %1 %2").arg(objcString(path)).arg(objcString([[args componentsJoinedByString:@" "])));
DEBUG_LOG(("Application Info: executing %1 %2").arg(objcString(path)).arg(objcString([args componentsJoinedByString:@" "])));
if (![NSTask launchedTaskWithLaunchPath:path arguments:args]) {
LOG(("Task not launched while executing %1 %2").arg(objcString(path)).arg(objcString([args componentsJoinedByString:@" "])));
return NO;