+
+// return all directories to search for given prefix
+static wxString GetAllMsgCatalogSubdirs(const char *prefix,
+ const char *lang)
+{
+ wxString searchPath;
+
+ // search first in prefix/fr/LC_MESSAGES, then in prefix/fr and finally in
+ // prefix (assuming the language is 'fr')
+ searchPath << prefix << wxFILE_SEP_PATH << lang << wxFILE_SEP_PATH
+ << "LC_MESSAGES" << wxPATH_SEP
+ << prefix << wxFILE_SEP_PATH << lang << wxPATH_SEP
+ << prefix << wxPATH_SEP;
+
+ return searchPath;
+}
+
+// construct the search path for the given language
+static wxString GetFullSearchPath(const char *lang)
+{
+ wxString searchPath;
+
+ // first take the entries explicitly added by the program
+ size_t count = s_searchPrefixes.Count();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ searchPath << GetAllMsgCatalogSubdirs(s_searchPrefixes[n], lang)
+ << wxPATH_SEP;
+ }
+
+ // then take the current directory
+ // FIXME it should be the directory of the executable
+ searchPath << GetAllMsgCatalogSubdirs(".", lang) << wxPATH_SEP;
+
+ // and finally add some standard ones
+ searchPath
+ << GetAllMsgCatalogSubdirs("/usr/share/locale", lang) << wxPATH_SEP
+ << GetAllMsgCatalogSubdirs("/usr/lib/locale", lang) << wxPATH_SEP
+ << GetAllMsgCatalogSubdirs("/usr/local/share/locale", lang);
+
+ return searchPath;
+}
+