spirit-po

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

spirit-po

chris beck
Greetings List,

I wanted to share news of a recent project that I started, using boost::spirit, which others might find useful or interesting.

The project is a header-only C++11 library using boost::spirit which I call "spirit-po". The library is for localization -- it parses GNU gettext po-files, containing translated strings, into a simple catalog object, and serves translation lookups with an interface similar to GNU libintl.

This library can be used as an alternative to libintl or boost::locale::gettext. The main advantages are
- You parse po files and not mo files at runtime, so you don't need to make GNU msgfmt a build-time dependency, and your translation files can be human readable UTF-8 and portable, rather than architecture-dependent mo files. This allows people to add or modify translations after build, and, send those translations to someone on a different machine, and use them in your program without having to "compile" the translations. It makes things generally a bit easier for translators when they are working as well.
- The library is very simple and transparent. po files have a very simple grammar and when written in qi it is only a few dozen lines. By contrast, the GNU libgettext-po source is written in ANSI C and the parsing / processing code is rather complex. If you want to know why something is parsed a certain way, or what characters are escaped, or modify / work-around something, the spirit-po version is much simpler to understand and modify.
- "spirit-po" is header-only, and only depends on boost-spirit. This might be really attractive if you are cross-compiling for an exotic target like emscripten.
- In this system, it's easy to do things like, load catalogs from two files and merge them into one master catalog. When working with mo files using libintl / boost::locale::gettext, this is not really supported, and you probably have to fiddle with the "textdomain" variable extensively instead to achieve the effect.

I worked on a project in the past where the developers decided not to use libintl because of its complexity, with all the textdomains and such, and instead used a hand-rolled mo-loader that loaded translations into a c++ hashmap object, based on the formal mo specification. I view this project as a new approach but sharing some of the motivations.

You can read more about the rationale for "spirit-po" on its github page: https://github.com/cbeck88/spirit-po

I also wanted to solicit feedback -- if you have any thoughts or suggestions I would love to hear them. I do plan to use this code in at least one project I am currently working on, so, it's not purely academic or anything. I have made the code available under the Boost license -- it is free software!

Best Regards,
Chris Beck

------------------------------------------------------------------------------

_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: spirit-po

Joel de Guzman
On 10/28/15 8:40 AM, chris beck wrote:

> Greetings List,
>
> I wanted to share news of a recent project that I started, using boost::spirit, which
> others might find useful or interesting.
>
> The project is a header-only C++11 library using boost::spirit which I call "spirit-po".
> The library is for localization -- it parses GNU gettext po-files, containing translated
> strings, into a simple catalog object, and serves translation lookups with an interface
> similar to GNU libintl.
>
> This library can be used as an alternative to libintl or boost::locale::gettext. The main
> advantages are
> - You parse po files and not mo files at runtime, so you don't need to make GNU msgfmt a
> build-time dependency, and your translation files can be human readable UTF-8 and
> portable, rather than architecture-dependent mo files. This allows people to add or modify
> translations after build, and, send those translations to someone on a different machine,
> and use them in your program without having to "compile" the translations. It makes things
> generally a bit easier for translators when they are working as well.
> - The library is very simple and transparent. po files have a very simple grammar and when
> written in qi it is only a few dozen lines. By contrast, the GNU libgettext-po source is
> written in ANSI C and the parsing / processing code is rather complex. If you want to know
> why something is parsed a certain way, or what characters are escaped, or modify /
> work-around something, the spirit-po version is much simpler to understand and modify.
> - "spirit-po" is header-only, and only depends on boost-spirit. This might be really
> attractive if you are cross-compiling for an exotic target like emscripten.
> - In this system, it's easy to do things like, load catalogs from two files and merge them
> into one master catalog. When working with mo files using libintl /
> boost::locale::gettext, this is not really supported, and you probably have to fiddle with
> the "textdomain" variable extensively instead to achieve the effect.
>
> I worked on a project in the past where the developers decided not to use libintl because
> of its complexity, with all the textdomains and such, and instead used a hand-rolled
> mo-loader that loaded translations into a c++ hashmap object, based on the formal mo
> specification. I view this project as a new approach but sharing some of the motivations.
>
> You can read more about the rationale for "spirit-po" on its github page:
> https://github.com/cbeck88/spirit-po
>
> I also wanted to solicit feedback -- if you have any thoughts or suggestions I would love
> to hear them. I do plan to use this code in at least one project I am currently working
> on, so, it's not purely academic or anything. I have made the code available under the
> Boost license -- it is free software!

Wonderful! Send me some info if you want the project added here:
http://boost-spirit.com/home/info/who-is-using-spirit/

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/


------------------------------------------------------------------------------
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: spirit-po

chris beck
Hello Joel,

I recently made the first stable release of spirit-po, if you would like to adverise it on your page, I would appreciate it. Here's some info:

-----

Link: https://github.com/cbeck88/spirit-po

Spirit-po is an open source, lightweight, header-only C++ library that can be used for localization within the GNU gettext system. Unlike libintl and boost::locale::gettext, spirit-po reads the same portable human-readable po files that translators produce, rather than reading the architecture-dependent mo files produced by the msgfmt tool. This means that translators can see their translations in your program without having to compile them, and users can send translated content associated to your program to one-another without issues. spirit-po is also more flexible in that allows modifying catalogs or merging catalogs from different files. The only external dependency is boost::spirit.

-----

Best Regards,
Chris

On Thu, Oct 29, 2015 at 7:46 PM, Joel de Guzman <[hidden email]> wrote:
On 10/28/15 8:40 AM, chris beck wrote:
> Greetings List,
>
> I wanted to share news of a recent project that I started, using boost::spirit, which
> others might find useful or interesting.
>
> The project is a header-only C++11 library using boost::spirit which I call "spirit-po".
> The library is for localization -- it parses GNU gettext po-files, containing translated
> strings, into a simple catalog object, and serves translation lookups with an interface
> similar to GNU libintl.
>
> This library can be used as an alternative to libintl or boost::locale::gettext. The main
> advantages are
> - You parse po files and not mo files at runtime, so you don't need to make GNU msgfmt a
> build-time dependency, and your translation files can be human readable UTF-8 and
> portable, rather than architecture-dependent mo files. This allows people to add or modify
> translations after build, and, send those translations to someone on a different machine,
> and use them in your program without having to "compile" the translations. It makes things
> generally a bit easier for translators when they are working as well.
> - The library is very simple and transparent. po files have a very simple grammar and when
> written in qi it is only a few dozen lines. By contrast, the GNU libgettext-po source is
> written in ANSI C and the parsing / processing code is rather complex. If you want to know
> why something is parsed a certain way, or what characters are escaped, or modify /
> work-around something, the spirit-po version is much simpler to understand and modify.
> - "spirit-po" is header-only, and only depends on boost-spirit. This might be really
> attractive if you are cross-compiling for an exotic target like emscripten.
> - In this system, it's easy to do things like, load catalogs from two files and merge them
> into one master catalog. When working with mo files using libintl /
> boost::locale::gettext, this is not really supported, and you probably have to fiddle with
> the "textdomain" variable extensively instead to achieve the effect.
>
> I worked on a project in the past where the developers decided not to use libintl because
> of its complexity, with all the textdomains and such, and instead used a hand-rolled
> mo-loader that loaded translations into a c++ hashmap object, based on the formal mo
> specification. I view this project as a new approach but sharing some of the motivations.
>
> You can read more about the rationale for "spirit-po" on its github page:
> https://github.com/cbeck88/spirit-po
>
> I also wanted to solicit feedback -- if you have any thoughts or suggestions I would love
> to hear them. I do plan to use this code in at least one project I am currently working
> on, so, it's not purely academic or anything. I have made the code available under the
> Boost license -- it is free software!

Wonderful! Send me some info if you want the project added here:
http://boost-spirit.com/home/info/who-is-using-spirit/

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/


------------------------------------------------------------------------------
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: spirit-po

Joel de Guzman
On 15/03/2016 4:18 AM, chris beck wrote:
> Hello Joel,
>
> I recently made the first stable release of spirit-po, if you would like to adverise it on
> your page, I would appreciate it. Here's some info:

Done. Wonderful library you've got there!

Regards,
--
Joel de Guzman
http://www.ciere.com
http://boost-spirit.com
http://www.cycfi.com/

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general