Sayonara Player
LanguageUtils.h
1/* LanguageUtils.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef LANGUAGEUTILS_H
22#define LANGUAGEUTILS_H
23
24#include "Utils/Macros.h"
25
26class QString;
27class QStringList;
28class QLocale;
29
30template<typename A, typename B>
31class QMap;
32
33namespace Util
34{
39 namespace Language
40 {
47 QString getSharePath(const QString& fourLetter);
48
55 QString getFtpPath(const QString& fourLetter);
56
63 QString getHttpPath(const QString& fourLetter);
64
71
78
85 QString getHomeTargetPath(const QString& fourLetter);
86
94 QString getUsedLanguageFile(const QString& fourLetter);
95
102 QString getIconPath(const QString& fourLetter);
103
110 QString extractLanguageCode(const QString& languageFile);
111
119 QString getChecksum(const QString& fourLetter);
120
128 QString getLanguageVersion(const QString& fourLetter);
129
136 void updateLanguageVersion(const QString& fourLetter);
137
145 bool isOutdated(const QString& fourLetter);
146
154 QString getSimilarLanguage4(const QString& fourLetter);
155
161
167
174 bool importLanguageFile(const QString& filename);
175
176
182 QString convertOldLanguage(const QString& languageCode);
183
184
191
192 #ifdef SAYONARA_WITH_TESTS
193 void setTestMode();
194 void setLanguageVersion(const QString& fourLetter, const QString& version);
195 #endif
196 }
197}
198
199#endif // LANGUAGEUTILS_H
Definition: LanguageUtils.h:31
void updateLanguageVersion(const QString &fourLetter)
Update language version in translations/versions file to current Sayonara Version.
QString getSharePath(const QString &fourLetter)
get the complete path to a language file out of the share directory
QString getLanguageVersion(const QString &fourLetter)
Get the language version out of translations/versions file in home dir.
QString getChecksum(const QString &fourLetter)
calculates the checksum for the currently used language file (either home or share directory)
QString getChecksumFtpPath()
Returns the path where checksums can be fetched from.
QString getUsedLanguageFile(const QString &fourLetter)
Returns the correct language file either from share dir or home dir.
QString extractLanguageCode(const QString &languageFile)
Extracts the language Code out of a sayonara_lang string.
QString getIconPath(const QString &fourLetter)
Returns the icon path in share directory.
QString getSimilarLanguage4(const QString &fourLetter)
get_similar_language_4
QString getFtpPath(const QString &fourLetter)
get the complete path to a language file out of the ftp directory
QString getChecksumHttpPath()
Returns the path where checksums can be fetched from.
QString getHttpPath(const QString &fourLetter)
get the complete http url to a language file
QString getHomeTargetPath(const QString &fourLetter)
get_home_target_path
bool isOutdated(const QString &fourLetter)
Returns if the language version in translations/versions file is smaller than the current sayonara ve...
QString convertOldLanguage(const QString &languageCode)
Converts two letter into four letter.
QStringList getCurrentQtTranslationPaths()
get all qt paths which include translations
bool importLanguageFile(const QString &filename)
Imports a qm file. The filename must contain a valid four or two letter code.
QMap< QString, QLocale > availableLanguages()
Returns all languages located in user path and all languages in sayonara path.
QLocale getCurrentLocale()
get the current selected locale based on the current language file
Helper functions.
Definition: GenreView.h:36