wxTranslations::SetLoader().
Catalogs are searched for in standard places (system locales directory,
- `LC_PATH` on Unix systems, Resources folder on OS X, executable's directory
- on Windows), but you may also prepend additional directories to the search
- path with AddCatalogLookupPathPrefix().
+ `LC_PATH` on Unix systems, Resources subdirectory of the application bundle
+ on OS X, executable's directory on Windows), but you may also prepend
+ additional directories to the search path with
+ AddCatalogLookupPathPrefix().
@since 2.9.1
*/
public:
/**
Add a prefix to the catalog lookup path: the message catalog files will
- be looked up under prefix/lang/LC_MESSAGES, prefix/lang and prefix
+ be looked up under prefix/lang/LC_MESSAGES and prefix/lang directories
(in this order).
This only applies to subsequent invocations of
wxString GetMsgCatalogSubdirs(const wxString& prefix, const wxString& lang)
{
// Search first in Unix-standard prefix/lang/LC_MESSAGES, then in
- // prefix/lang and finally in just prefix.
+ // prefix/lang.
//
// Note that we use LC_MESSAGES on all platforms and not just Unix, because
// it doesn't cost much to look into one more directory and doing it this
wxString searchPath;
searchPath.reserve(4*prefixAndLang.length());
- searchPath << prefixAndLang << wxFILE_SEP_PATH << "LC_MESSAGES" << wxPATH_SEP
+
+ searchPath
+#ifdef __WXOSX__
+ << prefixAndLang << ".lproj/LC_MESSAGES" << wxPATH_SEP
+ << prefixAndLang << ".lproj" << wxPATH_SEP
+#endif
+ << prefixAndLang << wxFILE_SEP_PATH << "LC_MESSAGES" << wxPATH_SEP
<< prefixAndLang << wxPATH_SEP
- << prefix;
+ ;
return searchPath;
}
// get prefixes to locale directories; if lang is empty, don't point to
// OSX's .lproj bundles
-wxArrayString GetSearchPrefixes(const wxString& lang = wxString())
+wxArrayString GetSearchPrefixes()
{
wxArrayString paths;
#if wxUSE_STDPATHS
// then look in the standard location
wxString stdp;
- if ( lang.empty() )
- {
- stdp = wxStandardPaths::Get().GetResourcesDir();
- }
- else
- {
- stdp = wxStandardPaths::Get().
- GetLocalizedResourcesDir(lang, wxStandardPaths::ResourceCat_Messages);
- }
+ stdp = wxStandardPaths::Get().GetResourcesDir();
if ( paths.Index(stdp) == wxNOT_FOUND )
paths.Add(stdp);
#endif // wxUSE_STDPATHS
wxString searchPath;
searchPath.reserve(500);
- const wxArrayString prefixes = GetSearchPrefixes(lang);
+ const wxArrayString prefixes = GetSearchPrefixes();
for ( wxArrayString::const_iterator i = prefixes.begin();
i != prefixes.end();