MofileReader
moFileReaderSDK

Include in project

Usage of this library is quite easy, simply add moFileReader.hpp to your project. Thats all you have to do. You can safely exclude mo.cpp, since this file keeps the entry-points of the .exe only.

Usage

This is moFileReader, a simple gettext-replacement. The usage of this library is, hopefully, fairly simple:

// Instanciate the class
moFileLib::moFileReader reader;
// Load a .mo-File.
if ( reader.ReadFile("myTranslationFile.mo") != moFileLib::moFileReader::EC_SUCCESS )
{
// Error Handling
}
// Now, you can lookup the strings you stored in the .mo-File:
std::cout << reader.Lookup("MyTranslationString") << std::endl;

Thats all! This small code has no dependencies, except the C/C++-runtime of your compiler, so it should work on all machines where a C++-runtime is provided.

Note
We do not yet support .mo-Files with reversed magic-numbers, since I don't have a file to test it and I hate to release stuff I wasn't able to test.

Changelog

  • Version 1.2.0
    • Proper implementation of contexts strings Now it uses a separate 2D map for storing strings with context
    • Fixed MagicNumber check not working on Linux
    • Removed duplicate code
    • Added option to disable convenience Class
  • Version 1.1.0
    • Converted library to a header-only library
  • Version 1.0.0
  • Version 0.1.2
    • Generic improvements to the documentation.
    • Generic improvements to the code
    • Fixed a bug in mo.cpp which caused the application not to print the help message if only –export or –lookup where missing.
    • Added -h, –help and -? to moReader[.exe]. It will print the help-screen.
    • Added –version and -v to moReader[.exe]. It will print some informations about the program.
    • Added –license to moReader[.exe]. This will print its license.
    • –export gives now a feedback about success or failure.
    • The HTML-Dump-Method outputs now the whole table from the empty msgid in a nice html-table, not only a few hardcoded.
    • I had an issue-report that the Error-Constants can collide with foreign code under certain conditions, so I added a patch which renamed the error-constants to more compatible names.
  • Version 0.1.1
    • Added the ability to export mo's as HTML.
    • Fixed a bug causing a crash when passing an invalid value to moFileReader::Lookup().
    • Added a new file, moFileConfig.h, holding the macros for the project.
    • Added the ability to be configured by cmake.
    • Added some more inline-functions, which really enhance the singleton.
  • Version 0.1.0

Credits

Gettext is part of the GNU-Tools and (C) by the Free Software Foundation.
Visual C++ Express is a registered Trademark of Microsoft, One Microsoft Way, Redmond, USA.
All other Trademarks are property of their respective owners.

Thanks for using this piece of OpenSource-Software.
Submit patches and/or bugs on https://github.com/AnotherFoxGuy/MofileReader. Send your flames, dumb comments etc to /dev/null, thank you.