From: Rudolf Polzer Date: Sun, 16 Jan 2011 20:43:17 +0000 (+0100) Subject: right before dialogs X-Git-Tag: xonotic-v0.5.0~318^2~100 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=59b38ca90da517b6a293abad9094e93465b7b77b;p=xonotic%2Fxonotic-data.pk3dir.git right before dialogs --- diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 1bfbca6ae..dcdd74dee 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -360,7 +360,10 @@ float buf_load(string pFilename) return -1; fh = fopen(pFilename, FILE_READ); if(fh < 0) - return buf; + { + buf_del(buf); + return -1; + } i = 0; while((l = fgets(fh))) { diff --git a/qcsrc/menu/stringfilelist.txt b/qcsrc/menu/stringfilelist.txt index 6017305fd..6016b1ba5 100644 --- a/qcsrc/menu/stringfilelist.txt +++ b/qcsrc/menu/stringfilelist.txt @@ -5,20 +5,16 @@ Guideline: unless in developer-only functions (e.g. *dumptree*) - mark translatable strings with _() - if a translatable string is a strcat monster, change it to sprintf +- if code loads files with text, allow loading + .cvar_string("prvm_language") in preference - test by: find . -type f -not -name \*.po | xgettext -LC -k_ -f- gamecommand.qc - interesting vi macros: :map # /" :map ' i_(2f"a)/" - List of files to do: -./xonotic/commandbutton.c -./xonotic/credits.c -./xonotic/crosshairbutton.c -./xonotic/cvarlist.c -./xonotic/demolist.c ./xonotic/dialog.c ./xonotic/dialog_credits.c ./xonotic/dialog_hudpanel_ammo.c @@ -79,3 +75,9 @@ List of files to do: ./xonotic/textslider.c ./xonotic/util.qc ./xonotic/weaponslist.c + + + +Unresolved TODO: + +- translated campaigns diff --git a/qcsrc/menu/xonotic/credits.c b/qcsrc/menu/xonotic/credits.c index 86609a659..d0131b3fa 100644 --- a/qcsrc/menu/xonotic/credits.c +++ b/qcsrc/menu/xonotic/credits.c @@ -30,7 +30,9 @@ void XonoticCreditsList_configureXonoticCreditsList(entity me) { me.configureXonoticListBox(me); // load the file - me.bufferIndex = buf_load("xonotic-credits.txt"); + me.bufferIndex = buf_load(strcat("xonotic-credits.txt.", cvar_string("prvm_language"))); + if(me.bufferIndex < 0) + me.bufferIndex = buf_load("xonotic-credits.txt"); me.nItems = buf_getsize(me.bufferIndex); } void XonoticCreditsList_destroy(entity me) diff --git a/qcsrc/menu/xonotic/cvarlist.c b/qcsrc/menu/xonotic/cvarlist.c index 3eaf2677e..587c73b93 100644 --- a/qcsrc/menu/xonotic/cvarlist.c +++ b/qcsrc/menu/xonotic/cvarlist.c @@ -81,15 +81,15 @@ void XonoticCvarList_setSelected(entity me, float i) t = cvar_type(me.cvarName); me.cvarType = ""; if(t & CVAR_TYPEFLAG_SAVED) - me.cvarType = strcat(me.cvarType, ", will be saved to config.cfg"); + me.cvarType = strcat(me.cvarType, _(", will be saved to config.cfg")); else - me.cvarType = strcat(me.cvarType, ", will not be saved"); + me.cvarType = strcat(me.cvarType, _(", will not be saved")); if(t & CVAR_TYPEFLAG_PRIVATE) - me.cvarType = strcat(me.cvarType, ", private"); + me.cvarType = strcat(me.cvarType, _(", private")); if(t & CVAR_TYPEFLAG_ENGINE) - me.cvarType = strcat(me.cvarType, ", engine setting"); + me.cvarType = strcat(me.cvarType, _(", engine setting")); if(t & CVAR_TYPEFLAG_READONLY) - me.cvarType = strcat(me.cvarType, ", read only"); + me.cvarType = strcat(me.cvarType, _(", read only")); me.cvarType = strzone(substring(me.cvarType, 2, strlen(me.cvarType) - 2)); me.cvarNameBox.setText(me.cvarNameBox, me.cvarName); diff --git a/qcsrc/menu/xonotic/dialog.c b/qcsrc/menu/xonotic/dialog.c index 7087d83cb..f18658c71 100644 --- a/qcsrc/menu/xonotic/dialog.c +++ b/qcsrc/menu/xonotic/dialog.c @@ -3,7 +3,7 @@ CLASS(XonoticDialog) EXTENDS(Dialog) // still to be customized by user /* ATTRIB(XonoticDialog, closable, float, 1) - ATTRIB(XonoticDialog, title, string, "Form1") // ;) + ATTRIB(XonoticDialog, title, string, _("Form1")) // ;) ATTRIB(XonoticDialog, color, vector, '1 0.5 1') ATTRIB(XonoticDialog, intendedWidth, float, 0) ATTRIB(XonoticDialog, rows, float, 3)