mainGNU gettext - Support: sr #108645, GNU gettext Switch languages

 
 

sr #108645: GNU gettext Switch languages

Submitter:  goodcyg <goodcyg>
Submitted:  Thu 04 Sep 2014 05:12:35 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed Operating System:  Microsoft Windows
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 11 Sep 2018 12:06:31 AM UTC, comment #2: 
Bruno Haible <haible>
Group administrator
Fri 05 Sep 2014 02:37:04 AM UTC, comment #1: 

I guess you need to call setlocale instead of (or in addition to) putenv?
http://msdn.microsoft.com/en-us/library/x99tb11d.aspx

Daiki Ueno <ueno>
Group administrator
Thu 04 Sep 2014 05:12:35 AM UTC, original submission:  

win7 64+VS2008
I wrote a simple gettext test procedures are as follows:
#include <stdio.h>
 #include <locale.h>
 #include "libintl.h"
 #include <Windows.h>
 #pragma comment(lib,"libintl.lib")
 #define _(S) gettext(S)
 #define PACKAGE "hello"
 int main(int argc, char **argv)
 {
     char tmp[51]= {0};
     int t;
     char path[MAX_PATH]= {0};
     _snprintf(tmp, 51, "LANG=%s", argv[1]);
     t=putenv(tmp);
     bindtextdomain(PACKAGE, "locale");
     bind_textdomain_codeset(PACKAGE,"UTF-8");
     textdomain(PACKAGE);
     printf(_("Hello!"));
     return 0;
 }
And then build Hello.Po, translation in the generated Hello.Mo file separately
 Placed in the following location:
.\Debug\locale\zh_TW\LC_MESSAGES\hello.mo
 .\Debug\locale\zh_CN\LC_MESSAGES\hello.mo
 .\Debug\locale\ja\LC_MESSAGES\hello.mo
 .\Debug\locale\en_US\LC_MESSAGES\hello.mo
 .\Debug\hello.exe
 .\Debug\libiconv2.dll
 .\Debug\libintl3.dll
Then you run Hello.exe zh_TW (Hello.exe ja Hello.exe en_US) show all Chinese instead of the appropriate language。
 \Debug\locale\ja\LC_MESSAGES\hello.mo,.\Debug\locale\en_US\LC_MESSAGES\hello.mo,.\Debug\locale\zh_TW\LC_MESSAGES\hello.mo
Copy respectively. under \Debug\locale\zh_CN\LC_MESSAGES\ was able to copy the appropriate language is displayed。
 Is unable to switch the interface language, toggle the display of all Chinese,why is this?

goodcyg <goodcyg>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by ueno (Posted a comment)
  • -email is unavailable- added by goodcyg (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-11 haible StatusNone Done
        Assigned toNone haible
        Open/ClosedOpen Closed
        Operating SystemNone Microsoft Windows

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code