Module: wine Branch: master Commit: 8f08aee04d101834336120f1fd480f2400d21f7b URL: http://source.winehq.org/git/wine.git/?a=commit;h=8f08aee04d101834336120f1fd...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Apr 7 11:19:08 2017 +0200
wrc: Only add translations for specific fields in version blocks.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
include/wine/wine_common_ver.rc | 12 ++++++------ tools/wrc/po.c | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/include/wine/wine_common_ver.rc b/include/wine/wine_common_ver.rc index b1b054d..39a17d6 100644 --- a/include/wine/wine_common_ver.rc +++ b/include/wine/wine_common_ver.rc @@ -125,14 +125,14 @@ FILESUBTYPE WINE_FILESUBTYPE /* LANG_ENGLISH/SUBLANG_DEFAULT, WINE_CODEPAGE */ BLOCK "0409" WINE_CODEPAGE_STR { - VALUE "CompanyName", "#msgctxt#do not translate#Microsoft Corporation" /* GameGuard depends on this */ + VALUE "CompanyName", "Microsoft Corporation" /* GameGuard depends on this */ VALUE "FileDescription", WINE_FILEDESCRIPTION_STR - VALUE "FileVersion", "#msgctxt#do not translate#" WINE_FILEVERSION_STR - VALUE "InternalName", "#msgctxt#do not translate#" WINE_FILENAME - VALUE "LegalCopyright", "#msgctxt#do not translate#" WINE_LEGALCOPYRIGHT - VALUE "OriginalFilename", "#msgctxt#do not translate#" WINE_FILENAME_STR + VALUE "FileVersion", WINE_FILEVERSION_STR + VALUE "InternalName", WINE_FILENAME + VALUE "LegalCopyright", WINE_LEGALCOPYRIGHT + VALUE "OriginalFilename", WINE_FILENAME_STR VALUE "ProductName", WINE_PRODUCTNAME_STR - VALUE "ProductVersion", "#msgctxt#do not translate#" WINE_PRODUCTVERSION_STR + VALUE "ProductVersion", WINE_PRODUCTVERSION_STR WINE_EXTRAVALUES } } diff --git a/tools/wrc/po.c b/tools/wrc/po.c index c28c7d8..7b09f10 100644 --- a/tools/wrc/po.c +++ b/tools/wrc/po.c @@ -917,6 +917,21 @@ static ver_block_t *get_version_langcharset_block( ver_block_t *block ) return NULL; }
+static int version_value_needs_translation( const ver_value_t *val ) +{ + int ret; + char *key; + + if (val->type != val_str) return 0; + if (!(key = convert_msgid_ascii( val->key, 0 ))) return 0; + + /* most values contain version numbers or file names, only translate a few specific ones */ + ret = (!strcasecmp( key, "FileDescription" ) || !strcasecmp( key, "ProductName" )); + + free( key ); + return ret; +} + static void add_pot_versioninfo( po_file_t po, const resource_t *res ) { ver_value_t *val; @@ -924,7 +939,8 @@ static void add_pot_versioninfo( po_file_t po, const resource_t *res )
if (!langcharset) return; for (val = langcharset->values; val; val = val->next) - add_po_string( po, val->value.str, NULL, NULL ); + if (version_value_needs_translation( val )) + add_po_string( po, val->value.str, NULL, NULL ); }
static void add_po_versioninfo( const resource_t *english, const resource_t *res )