aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorThierry Crozat2010-08-23 19:45:14 +0000
committerThierry Crozat2010-08-23 19:45:14 +0000
commitbc821136fdf2c82c1877c8ae0e607bcbe784dab1 (patch)
tree848141a4994e5bd13e8a7a9a304777e251927468 /tools
parent45a87ffe3fb76ae4e75d97271c0567809bd088d0 (diff)
downloadscummvm-rg350-bc821136fdf2c82c1877c8ae0e607bcbe784dab1.tar.gz
scummvm-rg350-bc821136fdf2c82c1877c8ae0e607bcbe784dab1.tar.bz2
scummvm-rg350-bc821136fdf2c82c1877c8ae0e607bcbe784dab1.zip
i18n: Add support for context in translations.
This change means there can now be different translations for the same english string depending on the context. It is based on gettext msgctxt feature. There is a new macro _c(msg, ctxt) that should be used instead of _(msg) in the source code when we want to add a context to the message. For the moment I have added contexts to only one message ("None") so that I could test the changes. Context could be added also to get shorter translations when GUI is in 1x mode. I have also added back the fuzzy option to msmerge since it is useful when adding contexts to populate the translations for the new contexts. svn-id: r52308
Diffstat (limited to 'tools')
-rw-r--r--tools/create_translations/create_translations.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/create_translations/create_translations.cpp b/tools/create_translations/create_translations.cpp
index af7dd02f82..fab35cdfd5 100644
--- a/tools/create_translations/create_translations.cpp
+++ b/tools/create_translations/create_translations.cpp
@@ -35,7 +35,7 @@
#include "create_translations.h"
#include "po_parser.h"
-#define TRANSLATIONS_DAT_VER 1 // 1 byte
+#define TRANSLATIONS_DAT_VER 2 // 1 byte
// Padding buffer (filled with 0) used if we want to aligned writes
// static uint8 padBuf[DATAALIGNMENT];
@@ -125,7 +125,6 @@ int main(int argc, char *argv[]) {
// ...
// Write length for translation description
- // Each description
len = 0;
for (lang = 0; lang < numLangs; lang++) {
len += stringSize(translations[lang]->language());
@@ -147,8 +146,10 @@ int main(int argc, char *argv[]) {
// the string size (two bytes for the number of chars and the string itself).
for (lang = 0; lang < numLangs; lang++) {
len = 2 + stringSize(translations[lang]->charset());
- for (i = 0; i < translations[lang]->size(); ++i)
+ for (i = 0; i < translations[lang]->size(); ++i) {
len += 2 + stringSize(translations[lang]->entry(i)->msgstr);
+ len += stringSize(translations[lang]->entry(i)->msgctxt);
+ }
writeUint16BE(outFile, len);
}
@@ -171,6 +172,7 @@ int main(int argc, char *argv[]) {
for (i = 0; i < translations[lang]->size(); ++i) {
writeUint16BE(outFile, messageIds.findIndex(translations[lang]->entry(i)->msgid));
writeString(outFile, translations[lang]->entry(i)->msgstr);
+ writeString(outFile, translations[lang]->entry(i)->msgctxt);
}
}