* Only list languages if they're actually installed (checking for the existence

of the actual .mo file)
* Add ja to the list of possbile translations.

Originally committed to SVN as r2685.
This commit is contained in:
Amar Takhar 2009-01-12 21:20:53 +00:00
parent c476b7b883
commit 439a2c547e

View file

@ -46,7 +46,7 @@
#include <wx/choicdlg.h>
#include "aegisublocale.h"
#include "standard_paths.h"
#include <wx/stdpaths.h>
///////////////
// Constructor
@ -150,6 +150,7 @@ wxArrayInt AegisubLocale::GetAvailableLanguages() {
_T("fr_FR"),
_T("hu"),
_T("it"),
_T("ja"),
_T("ko"),
_T("ru"),
_T("pt_BR"),
@ -159,9 +160,12 @@ wxArrayInt AegisubLocale::GetAvailableLanguages() {
size_t len = sizeof(langs)/sizeof(wchar_t*);
for (size_t i=0; i<len; i++) {
const wxLanguageInfo *lang = wxLocale::FindLanguageInfo(langs[i]);
if (lang) final.Add(lang->Language);
}
// If the locale file doesn't exist then don't list it as an option.
wxString locDir = wxStandardPaths::Get().GetLocalizedResourcesDir(langs[i], wxStandardPathsBase::ResourceCat_Messages);
wxFileName file(wxString::Format(_T("%s/%s.mo"), locDir.c_str(), _T(GETTEXT_PACKAGE)));
if (lang && file.FileExists()) final.Add(lang->Language);
}
#endif
return final;