i18n: integrate translations to packaging
This commit adds internationalization support
We interface with Transifex as our web translation platform.
Two new scripts:
- generate-strings.sh: generates source files in English.
We need one source file by UI file
(Apple's law) + one Localizable.strings for strings in code.
- update-translations.sh: pulls translations completes at 75% at least
from transifex, and cleanup the files (UTF-16LE to UTF-8 encoding,
and remove first line with corrupted char)
Issue: #80347
Change-Id: Iefd297e424aaacefe6e867192e10dabd21bfb8d2
diff --git a/src/AccRingVC.mm b/src/AccRingVC.mm
index 448a500..54e99dd 100644
--- a/src/AccRingVC.mm
+++ b/src/AccRingVC.mm
@@ -113,7 +113,8 @@
[bootstrapField setStringValue:account->hostname().toNSString()];
if([account->username().toNSString() isEqualToString:@""])
- [hashField setStringValue:@"Reopen account to see your hash"];
+ [hashField setStringValue:NSLocalizedString(@"Reopen account to see your hash",
+ @"Show advice to user")];
else
[hashField setStringValue:account->username().toNSString()];
diff --git a/src/AccSecurityVC.mm b/src/AccSecurityVC.mm
index ef955c8..859c430 100644
--- a/src/AccSecurityVC.mm
+++ b/src/AccSecurityVC.mm
@@ -353,7 +353,7 @@
[openPanel setTitle:NSLocalizedString(@"Choose a private key file", @"Open panel title")];
}
- [openPanel setPrompt:NSLocalizedString(@"Choose", @"Open panel prompt for 'Choose a file'")];
+ [openPanel setPrompt:NSLocalizedString(@"Choose CA", @"Open panel prompt for 'Choose a file'")];
[openPanel setDelegate:self];
}
diff --git a/src/AudioPrefsVC.mm b/src/AudioPrefsVC.mm
index 1248932..25218be 100644
--- a/src/AudioPrefsVC.mm
+++ b/src/AudioPrefsVC.mm
@@ -166,7 +166,7 @@
[openPanel setCanChooseFiles:NO];
[openPanel setResolvesAliases:YES];
[openPanel setTitle:NSLocalizedString(@"Choose a file", @"Open panel title")];
- [openPanel setPrompt:NSLocalizedString(@"Choose", @"Open panel prompt for 'Choose a directory'")];
+ [openPanel setPrompt:NSLocalizedString(@"Choose file", @"Open panel prompt for 'Choose a directory'")];
[openPanel setDelegate:self];
}
diff --git a/src/HistoryVC.mm b/src/HistoryVC.mm
index b1b4400..8eb1b5a 100644
--- a/src/HistoryVC.mm
+++ b/src/HistoryVC.mm
@@ -200,7 +200,7 @@
if (!contactmethod->contact() || contactmethod->contact()->isPlaceHolder()) {
NSMenu *theMenu = [[NSMenu alloc]
initWithTitle:@""];
- [theMenu insertItemWithTitle:@"Add to contact"
+ [theMenu insertItemWithTitle:NSLocalizedString(@"Add to contacts", @"Contextual menu action")
action:@selector(addToContact)
keyEquivalent:@"a"
atIndex:0];
diff --git a/src/RingWizardWC.mm b/src/RingWizardWC.mm
index dfbf31c..9f262fb 100644
--- a/src/RingWizardWC.mm
+++ b/src/RingWizardWC.mm
@@ -81,7 +81,8 @@
if(![self checkForRingAccount]) {
accountToCreate = AccountModel::instance()->add("", Account::Protocol::RING);
} else {
- [indicationLabel setStringValue:@"Ring is already ready to work"];
+ [indicationLabel setStringValue:NSLocalizedString(@"Ring is already ready to work",
+ @"Display message to user")];
auto accList = AccountModel::instance()->getAccountsByProtocol(Account::Protocol::RING);
[self displayHash:accList[0]->username().toNSString()];
[showCustomCertsButton setHidden:YES];
@@ -115,7 +116,8 @@
NSSharingService* emailSharingService = [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeEmail];
- [createButton setTitle:@"Share by mail"];
+ [createButton setTitle:NSLocalizedString(@"Share by mail",
+ @"Share button")];
[createButton setAlternateImage:emailSharingService.alternateImage];
[createButton setAction:@selector(shareByEmail)];
}
@@ -125,7 +127,8 @@
[nickname setHidden:YES];
[progressBar setHidden:NO];
[createButton setEnabled:NO];
- [indicationLabel setStringValue:@"Just a moment..."];
+ [indicationLabel setStringValue:NSLocalizedString(@"Just a moment...",
+ @"Indication for user")];
QModelIndex qIdx = AccountModel::instance()->protocolModel()->selectionModel()->currentIndex();
@@ -166,7 +169,7 @@
NSLog(@"Account created!");
[progressBar setHidden:YES];
[createButton setEnabled:YES];
- [indicationLabel setStringValue:@"This is your number, share it with your friends!"];
+ [indicationLabel setStringValue:NSLocalizedString(@"This is your number, share it with your friends!", @"Indication to user")];
[self displayHash:account->username().toNSString()];
});
}
diff --git a/src/main.mm b/src/main.mm
index 248dc7e..5a8f5e0 100644
--- a/src/main.mm
+++ b/src/main.mm
@@ -38,6 +38,9 @@
#import <QTranslator>
#import <QLocale>
+//LRC
+#import <personmodel.h>
+
#import "backends/AddressBookBackend.h"
#import "delegates/ImageManipulationDelegate.h"