c# - Internationalisation with Gtk# on Win7 32 Bit -
i've c# application uses gtk# , .net (no mono). try translate gtk.label in application didn't work.
the mo-file lies under:
c:\locale\de\lc_messages\aboutbox.mo
i can access file , strings by:
// not work , results 'product' mono.posix.catalog.init("aboutbox", @"c:\locale"); var proposix = mono.unix.catalog.getstring("product"); // works , shows translated string mono.unix.catalog.init("aboutbox", @"c:\locale"); var prounix = mono.unix.catalog.getstring("product");
as conclusion think, mo file correct. main problem is, in gtk# doesn't work well:
the gtkbuilder initalized:
_aboutbuilder = new gtk.builder(); _aboutbuilder.translationdomain = "aboutbox"; //_aboutbuilder.addfromstring(system.io.file.readalltext(devicegladepath)); var result = _aboutbuilder.addfromfile(devicegladepath);
the language set 'de' on thread, uithread, lang, language. didn't expect problem.
questions: 1) why gtk# translation not working? 2) why posix.catalog not working, mono.catalog? 3) how can set locale dir in gtk#? (maybe problem)
i toyed around days, can't find anything.
i don't know if going you, used translations in project. i'm using xamarin studio, guess should work using other tool.
first set translation project inside solution. name i18n.
then init catalog catalog.init("i18n", "./locale"). when building project locale folder contains .mo files.
then whenever need translation : catalog.getstring("foo") (or catalog.getpluralstring, haved used yet).
here code :
using mono.unix; ... // @ startup catalog.init("i18n", "./locale"); ... // code console.writeline(catalog.getstring("hello, world!"));
Comments
Post a Comment