2012-02-20 21:47:14 +00:00
|
|
|
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
2009-05-24 16:38:08 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
2024-11-07 03:53:04 +00:00
|
|
|
#pragma once
|
2009-05-24 16:38:08 +00:00
|
|
|
|
|
|
|
#include <QString>
|
2012-02-26 04:07:33 +00:00
|
|
|
#include "wstring_qt.hh"
|
2009-05-24 16:38:08 +00:00
|
|
|
/// Language-specific stuff - codes, names, ids etc.
|
|
|
|
namespace Language {
|
|
|
|
|
|
|
|
/// This identifies any language uniquely within the program. It also has
|
|
|
|
/// two special meanings - Unknown and Any.
|
|
|
|
using Id = quint32;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
/// Value for Id which signifies that the language is unknown or unspecified.
|
|
|
|
Unknown = 0,
|
|
|
|
/// Value for Id which signifies that the language can be any, or all of them.
|
|
|
|
Any = 0xFFffFFff
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Returns name in English for the given Id. If the Id is incorrect, or has
|
|
|
|
/// Unknown/Any values, returns empty string.
|
|
|
|
QString englishNameForId( Id );
|
|
|
|
|
|
|
|
/// Returns name for the given Id, translated to the current UI language.
|
|
|
|
/// If the Id is incorrect, or has Unknown/Any values, returns empty string.
|
|
|
|
QString localizedNameForId( Id );
|
|
|
|
|
2009-08-07 17:00:03 +00:00
|
|
|
/// Returns a two-letter code of a country which speaks the given language.
|
|
|
|
/// This is useful for picking up icons for languages. If there's no
|
|
|
|
/// corresponding country it the database, returns an empty strings.
|
|
|
|
QString countryCodeForId( Id );
|
|
|
|
|
2012-09-24 12:51:51 +00:00
|
|
|
/// Returns name for the given Id, translated to the current UI language, wish corresponding image tag.
|
|
|
|
/// If the Id is incorrect, or has Unknown/Any values, returns empty string.
|
|
|
|
QString localizedStringForId( Id );
|
2023-04-28 00:21:36 +00:00
|
|
|
QString languageForLocale( const QString & locale );
|
|
|
|
// All other functions are to be used from LangCoder, which is supposed to
|
2009-05-24 16:38:08 +00:00
|
|
|
// be migrated here over time.
|
|
|
|
|
2012-01-28 03:07:23 +00:00
|
|
|
struct BabylonLang
|
|
|
|
{
|
|
|
|
Id id;
|
|
|
|
const QString contryCode;
|
|
|
|
const QString englishName;
|
|
|
|
const char * localizedName;
|
|
|
|
};
|
|
|
|
BabylonLang getBabylonLangByIndex( int index );
|
2012-02-26 04:07:33 +00:00
|
|
|
quint32 findBlgLangIDByEnglishName( gd::wstring const & lang );
|
2009-05-24 16:38:08 +00:00
|
|
|
} // namespace Language
|