gettext

poedit workaround for dynamic gettext

I have started using gettext for translating text and messages i send to user. I am using poedit as an editor, but i am struggling with dynamic messages. For example i have things like the login where i have a variable that tells the type of error. $this->translate('page-error-' . $error); When i auto update from poedit this gets rea...

What's a good alternative to GNU gettext for projects incompatible with the copyleft license?

What are the alternatives to gettext for software internationalization on projects not released under the GNU GPL? ...

Where to translate message strings - in the view or in the model?

We have a multilingual (PHP) application and use gettext for i18n. There are a few classes in the backend/model that return messages or message formats for printf(). We use xgettext to extract the strings that we want to translate. We apply the gettext function T_() in the frontend/view - this seems to be where it belongs. So far we ke...

C++ clean i18n library

I would like to have an easy to use way to write code like: #include <iostream> int main (){ std::cout << "hello, world!\n"; } but that supports i18n. Here is an example using gettext(): #include <libintl.h> #include <iostream> int main (){ std::cout << gettext("hello, world!\n"); } This can then be processed by xgettext to...

Complete C++ i18n gettext() "hello world" example.

I am looking for a complete i18n gettext() hello world example. I have started a script based upon A tutorial on Native Language Support using GNU gettext by G. Mohanty. I am using Linux and G++. Code: cat >hellogt.cxx <<EOF // hellogt.cxx #include <libintl.h> #include <locale.h> #include <iostream> #include <cstdlib> int main (){ ...

msginit email address command line argument?

msginit prompts for an email address. Is there a way to tell msginit what email address to use without being prompted for it such as a command line argument? cat >hellogt.cxx <<EOF // hellogt.cxx #include <libintl.h> #include <locale.h> #include <iostream> int main (){ setlocale(LC_ALL, ""); bindtextdomain("hellogt", "./"); ...

Set the language for a single program execution.

Complete C++ i18n gettext() “hello world” example. sets the LANG environment variable using export before executing the program (Linux): export LANG=es_MX.utf8 ./hellogt Is there a way to set the language just while executing hellogt, like a command line argument? This would be handy for testing programs. ...

What is ANALYZE/CATALOG for Linux msginit binary message catalog?

VMS has an ANALYZE command that examines an item such as an executable image or an object file displaying information about its contents. Is there such a command for examining the output of msginit which is a binary message catalog file? Something equivalent to ANALYZE/CATALOG? ...

Is there an easy way to programmatically list all the message IDs in a .MO file?

I have a big ol' .po file containing all the user-facing strings I need for my PHP app. I'd like to know if there's a PHP function I can use to get a list of all the msgid strings stored in the .po or the .mo. I didn't see a published PHP function that does this. Anyone know of something similar, or will I have to manually parse my ...

Why does locale es_MX work but not es?

Wikipedia entry for GNU gettext shows an example where the locale is just the lanuage, "fr". Whereas the i18n gettext() “hello world” example has the locale value with both the language and country, "es_MX". I have modified the "es_MX" example to use just the lanuage, "es", but it produces the English text rather the expected Spanish. c...

msgfmt "invalid multibyte sequence" error on a Polish text.

Using Complete C++ i18n gettext() “hello world” example I changed the locale from "es_MX" to "pl_PL" and the text from "hello, world!" to "Invalid input. Enter a string at least 20 characters long.". The Polish translation contains several characters that cause "invalid multibyte sequence" errors from msgfmt, "łąźó". The translated text ...

Command or option for the xgettext, msginit, msgfmt sequence for setting the MIME type?

msgfmt “invalid multibyte sequence” error on a Polish text is corrected by manually editing the MIME Content-Type charset in the template file. Is there some command or option for the xgettext, msginit, msgfmt sequence for setting the MIME type? cat >plt.cxx <<EOF // plt.cxx #include <libintl.h> #include <locale.h> #include <iostream> i...

I18n for XSLT (or what is the gettext() and xgettext of C++ for XSLT)?

Complete C++ i18n gettext() “hello world” example shows a standard way to handle messages in a C++ program using gettext(). The message catalogs are stored in Portable Object files based upon a Portable Object Template file created directly from the C++ source code using xgettext, msginit and msgfmt. What is the corresponding method for ...

I18n C++ hello world with plurals.

Complete C++ i18n gettext() “hello world” example has C++ code that works for a simple fixed string. I am now looking for an example program that works with plurals. This example code displays six lines. Only one is correct in English. It does not handle the plurals correctly. cat >helloplurals.cxx <<EOF // hellopurals.cxx #include <lib...

How to initialize a static char* with gettetxt() using local operating system environment?

Is there a standard or common way in C++ to handle static strings that need to be set by gettext()? Here is an example using the answer to Complete C++ i18n gettext() “hello world” example as a base just changing the literal hello world to a static char* hws and char* hw. It looks like hws is getting initialized to the default English t...

.po to .mo convertor in php?

i want a PHP script which can convert .po(Portable Object) as .mo(Machine Object) file? is any script available in PHP? byte +------------------------------------------+ 0 | magic number = 0x950412de | | | 4 | file f...

Is there way to create empty .mo file template?

Is there way of creating empty .mo file? Usually when starting new project I get stuck with this when there's no need for translations yet. I tried this with no luck: msgfmt /dev/null --output-file foo.mo ...

Adding support for i18n in PHP with gettext?

I've always heard about gettext - I know it's some sort of unix command to lookup a translation based on the string argument provided, and then produces a .pot file but can someone explain to me in layman's terms how this is taken care of in a web framework? I might get around to looking at how some established framework has done it, bu...

Very strange problem with Gettext and Haml on Rails / rake updatepo broke

Hi, I'm on Rails 2.3.3 and using Haml 2.0.9 for my templates and Gettext-Rails 2.0.4 for the translation. Haml works like a charm and gettext is also working like it should. But I cant get Gettext to parse Haml Files when using "rake updatepo". I created a custom parser like this: # lib/haml_parser.rb require 'gettext_rails/tools' req...

Rails: gettext pot generation task generates empty files

Hello, my problem is that in my app I want to generate the gettext .pot file with rake but I'm getting a file with no keys, only the header text ("Some descriptive title. Copyright (C)..."). I'm using the task gettext:find getttext_18n_rails. I tried before with the classic updatepo task but was the same. Perhaps am I missing any gem? ...