[Supertux-Commit] [tinygettext commit] r135 - in branches/tinygettext-portable: . src

codesite-noreply at google.com codesite-noreply at google.com
Sun Feb 1 05:45:12 PST 2009


Author: grumbel
Date: Sun Feb  1 05:44:02 2009
New Revision: 135

Modified:
    branches/tinygettext-portable/TODO
    branches/tinygettext-portable/src/dictionary.hpp
    branches/tinygettext-portable/src/dictionary_manager.cpp
    branches/tinygettext-portable/src/dictionary_manager.hpp

Log:
DictionaryManager::get_languages() returns Language objects

Modified: branches/tinygettext-portable/TODO
==============================================================================
--- branches/tinygettext-portable/TODO	(original)
+++ branches/tinygettext-portable/TODO	Sun Feb  1 05:44:02 2009
@@ -21,8 +21,37 @@
      FL_FreeLocale(&locale);
    }
  
-tinygettext specific stuff:
-===========================
+tinygettext API related stuff:
+==============================
+
+* add a way to toggle if fuzzy messages should be included or not
+  (requires changes to POParser)
+
+* comments should be parsed, since they contain meta information such
+  as fuzzy markers
+
+* enumerating files should fallback to more generic languages, i.e.:
+
+  de_AT should load de.po (somewhat already the case, but different  
mechanic then supertux)
+
+* iconv handling needs cleanup, since some systems don't provide
+  iconv, but SDL does and is used by many games, currently HAVE_SDL
+  macro seems to weak a fix. We could copy SDL's iconv handling into
+  tinygettext.
+
+* Customizability could use grouping and documentation or other means
+  to make it more obvious:
+
+  - POParser::pedantic
+  - enumerate_files (list files in directory)
+  - free_list (cleanup, of the above)
+  - open file (return std::istream)
+  - iconv (???)
+  - logging (log_callback(std::string))
+
+
+tinygettext implementation details:
+===================================

  * the transformation from POFile -> Dictionary shouldn't need a
    Language object, only PluralForms are needed and those are in the
@@ -63,23 +92,6 @@

  * add proper plural forms for languages marked 'unknown'

-* add a way to toggle if fuzzy messages should be included or not
-  (requires changes to POParser)
-
-* comments should be parsed, since they contain meta information such
-  as fuzzy markers
-
-* std::set<std::string> DictionaryManager::get_languages() should return  
std::set<Language>
-
-* enumerating files should fallback to more generic languages, i.e.:
-
-  de_AT should load de.po (somewhat already the case, but different  
mechanic then supertux)
-
-* iconv handling needs cleanup, since some systems don't provide
-  iconv, but SDL does and is used by many games, currently HAVE_SDL
-  macro seems to weak a fix. We could copy SDL's iconv handling into
-  tinygettext.
-
  * figure out how up-to-date other tinygettext implementations in the
    wild are (LinCity):

@@ -107,16 +119,5 @@
  * recomment a way to handle translation of speech and other data files

  * document how to use tinygettext and make it work like gettext
-
-* Customizability could use grouping and documentation or other means
-  to make it more obvious:
-
-  - POParser::pedantic
-  - enumerate_files (list files in directory)
-  - free_list (cleanup, of the above)
-  - open file (return std::istream)
-  - iconv (???)
-  - logging (log_callback(std::string))
-
  
  # EOF #

Modified: branches/tinygettext-portable/src/dictionary.hpp
==============================================================================
--- branches/tinygettext-portable/src/dictionary.hpp	(original)
+++ branches/tinygettext-portable/src/dictionary.hpp	Sun Feb  1 05:44:02  
2009
@@ -44,6 +44,7 @@

    std::string translate(const Entries& dict, const std::string& msgid);
    std::string translate_plural(const Entries& dict, const std::string&  
msgid, const std::string& msgidplural, int num);
+
  public:
    /** */
    Dictionary(const Language& language, const std::string& charset  
= "UTF-8");

Modified: branches/tinygettext-portable/src/dictionary_manager.cpp
==============================================================================
--- branches/tinygettext-portable/src/dictionary_manager.cpp	(original)
+++ branches/tinygettext-portable/src/dictionary_manager.cpp	Sun Feb  1  
05:44:02 2009
@@ -18,6 +18,7 @@
  //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,  
USA.

  #include <stdlib.h>
+#include <string.h>
  #include <fstream>
  #include <algorithm>

@@ -155,10 +156,10 @@
      }
  }

-std::set<std::string>
+std::set<Language>
  DictionaryManager::get_languages()
  {
-  std::set<std::string> languages;
+  std::set<Language> languages;

    for (SearchPath::iterator p = search_path.begin(); p !=  
search_path.end(); ++p)
      {
@@ -169,12 +170,13 @@
          }
        else
          {
-          for(const char* const* file = files; *file != 0; file++) {
-            if(has_suffix(*file, ".po")) {
-              std::string filename = *file;
-              languages.insert(filename.substr(0, filename.length()-3));
+          for(const char* const* file = files; *file != 0; file++)
+            {
+              if(has_suffix(*file, ".po"))
+                {
+                  languages.insert(Language::from_env(std::string(*file,  
strlen(*file)-3)));
+                }
              }
-          }
            dir_op.free_list(files);
          }
      }

Modified: branches/tinygettext-portable/src/dictionary_manager.hpp
==============================================================================
--- branches/tinygettext-portable/src/dictionary_manager.hpp	(original)
+++ branches/tinygettext-portable/src/dictionary_manager.hpp	Sun Feb  1  
05:44:02 2009
@@ -78,7 +78,7 @@
    void add_directory(const std::string& pathname);

    /** Return a set of the available languages in their country code */
-  std::set<std::string> get_languages();
+  std::set<Language> get_languages();

    void set_dir_op(const DirOp& dir_op);
  };


More information about the Supertux-Commit mailing list