diff options
author | Yotam Barnoy | 2010-10-31 11:08:43 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-10-31 11:08:43 +0000 |
commit | 94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1 (patch) | |
tree | 3df2a4ae7967c56d464729669fc06ce4e93dff36 /common/translation.cpp | |
parent | 8df4278ba8cfbf71228e1927f9db635a9a30a57f (diff) | |
parent | dca3c8d8bfc6c4db38cf8e8291818dd472041d4e (diff) | |
download | scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.gz scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.bz2 scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.zip |
Updated with latest from trunk
svn-id: r53976
Diffstat (limited to 'common/translation.cpp')
-rw-r--r-- | common/translation.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/common/translation.cpp b/common/translation.cpp index 1328ed62d2..a33e1a5243 100644 --- a/common/translation.cpp +++ b/common/translation.cpp @@ -213,6 +213,12 @@ const char *TranslationManager::getCurrentCharset() { return _currentCharset.c_str(); } +const char *TranslationManager::getCurrentLanguage() { + if (_currentLang == -1) + return "C"; + return _langs[_currentLang].c_str(); +} + String TranslationManager::getTranslation(const String &message) { return getTranslation(message.c_str()); } @@ -264,18 +270,18 @@ bool TranslationManager::openTranslationsFile(File& inFile) { // First try to open it directly (i.e. using the SearchMan). if (inFile.open("translations.dat")) return true; - + // Then look in the Themepath if we can find the file. if (ConfMan.hasKey("themepath")) return openTranslationsFile(FSNode(ConfMan.get("themepath")), inFile); - + return false; } bool TranslationManager::openTranslationsFile(const FSNode &node, File& inFile, int depth) { if (!node.exists() || !node.isReadable() || !node.isDirectory()) return false; - + // Check if we can find the file in this directory // Since File::open(FSNode) makes all the needed tests, it is not really // necessary to make them here. But it avoid printing warnings. @@ -284,21 +290,21 @@ bool TranslationManager::openTranslationsFile(const FSNode &node, File& inFile, if (inFile.open(fileNode)) return true; } - + // Check if we exceeded the given recursion depth if (depth - 1 == -1) - return false; - + return false; + // Otherwise look for it in sub-directories FSList fileList; if (!node.getChildren(fileList, FSNode::kListDirectoriesOnly)) return false; - + for (FSList::iterator i = fileList.begin(); i != fileList.end(); ++i) { if (openTranslationsFile(*i, inFile, depth == -1 ? - 1 : depth - 1)) return true; } - + // Not found in this directory or its sub-directories return false; } @@ -318,7 +324,7 @@ void TranslationManager::loadTranslationsInfoDat() { // Get number of translations int nbTranslations = in.readUint16BE(); - + // Skip all the block sizes for (int i = 0; i < nbTranslations + 2; ++i) in.readUint16BE(); @@ -467,12 +473,15 @@ String TranslationManager::getTranslation(const String &message, const String &) const TLangArray TranslationManager::getSupportedLanguageNames() const { return TLangArray(); } - + const char *TranslationManager::getCurrentCharset() { return "ASCII"; } +const char *TranslationManager::getCurrentLanguage() { + return "C"; +} + #endif // USE_TRANSLATION } // End of namespace Common - |