Audacity 3.2.0
|
Determine installed languages. More...
#include "Languages.h"
#include <memory>
#include "wxArrayStringEx.h"
#include "Internat.h"
#include <wx/defs.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/intl.h>
#include <wx/stdpaths.h>
#include <wx/textfile.h>
#include <wx/utils.h>
#include <clocale>
#include <unordered_map>
#include <CoreFoundation/CFPreferences.h>
#include <wx/osx/core/cfstring.h>
#include "FutureStrings.h"
Go to the source code of this file.
Namespaces | |
namespace | Languages |
Typedefs | |
using | LangHash = std::unordered_map< wxString, TranslatableString > |
using | ReverseLangHash = std::unordered_map< TranslatableString, wxString > |
Functions | |
static void | FindFilesInPathList (const wxString &pattern, const FilePaths &pathList, FilePaths &results) |
static bool | TranslationExists (const FilePaths &pathList, wxString code) |
wxString | Languages::GetSystemLanguageCode (const FilePaths &pathList) |
void | Languages::GetLanguages (FilePaths pathList, wxArrayString &langCodes, TranslatableStrings &langNames) |
wxString | Languages::SetLang (const FilePaths &pathList, const wxString &lang) |
wxString | Languages::GetLocaleName () |
wxString | Languages::GetLang () |
wxString | Languages::GetLangShort () |
Variables | |
static std::unique_ptr< wxLocale > | Languages::sLocale |
static wxString | Languages::sLocaleName |
Determine installed languages.
Figure out what translations are installed and return a list of language codes (like "es", "fr", or "pt-br") and corresponding language names (like "Español", "Français", and "Português"). We use our own list of translations of language names (i.e. "Français" instead of "French") but we fallback on the language name in wxWidgets if we don't have it listed.
This code is designed to work well with all of the current languages, but adapt to any language that wxWidgets supports. Other languages will only be supported if they're added to the database using wxLocale::AddLanguage.
But for the most part, this means that somebody could add a NEW translation and have it work immediately.
Definition in file Languages.cpp.
using LangHash = std::unordered_map<wxString, TranslatableString> |
Definition at line 52 of file Languages.cpp.
using ReverseLangHash = std::unordered_map<TranslatableString, wxString> |
Definition at line 53 of file Languages.cpp.
|
static |
Definition at line 55 of file Languages.cpp.
Referenced by TranslationExists().
|
static |
Definition at line 65 of file Languages.cpp.
References FindFilesInPathList().
Referenced by Languages::GetLanguages().