+
+// return all directories to search for given prefix
+static wxString GetAllMsgCatalogSubdirs(const wxChar *prefix,
+ const wxChar *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
+ << _T("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 wxChar *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(_T("."), lang) << wxPATH_SEP;
+
+ // and finally add some standard ones
+ searchPath
+ << GetAllMsgCatalogSubdirs(_T("/usr/share/locale"), lang) << wxPATH_SEP
+ << GetAllMsgCatalogSubdirs(_T("/usr/lib/locale"), lang) << wxPATH_SEP
+ << GetAllMsgCatalogSubdirs(_T("/usr/local/share/locale"), lang);
+
+ return searchPath;
+}
+