File indexing completed on 2025-01-19 03:55:57
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2006-02-23 0007 * Description : item metadata interface - Iptc helpers. 0008 * 0009 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2006-2013 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0011 * SPDX-FileCopyrightText: 2011 by Leif Huhn <leif at dkstat dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #include "dmetadata.h" 0018 0019 // Qt includes 0020 0021 #include <QLocale> 0022 0023 // KDE includes 0024 0025 #include <klocalizedstring.h> 0026 0027 // Local includes 0028 0029 #include "metaenginesettings.h" 0030 #include "digikam_version.h" 0031 #include "digikam_globals.h" 0032 #include "digikam_debug.h" 0033 0034 namespace Digikam 0035 { 0036 0037 IptcCoreContactInfo DMetadata::getCreatorContactInfo() const 0038 { 0039 MetadataFields fields; 0040 fields << MetadataInfo::IptcCoreContactInfoCity 0041 << MetadataInfo::IptcCoreContactInfoCountry 0042 << MetadataInfo::IptcCoreContactInfoAddress 0043 << MetadataInfo::IptcCoreContactInfoPostalCode 0044 << MetadataInfo::IptcCoreContactInfoProvinceState 0045 << MetadataInfo::IptcCoreContactInfoEmail 0046 << MetadataInfo::IptcCoreContactInfoPhone 0047 << MetadataInfo::IptcCoreContactInfoWebUrl; 0048 0049 QVariantList metadataInfos = getMetadataFields(fields); 0050 0051 IptcCoreContactInfo info; 0052 0053 if (metadataInfos.size() == 8) 0054 { 0055 info.city = metadataInfos.at(0).toString(); 0056 info.country = metadataInfos.at(1).toString(); 0057 info.address = metadataInfos.at(2).toString(); 0058 info.postalCode = metadataInfos.at(3).toString(); 0059 info.provinceState = metadataInfos.at(4).toString(); 0060 info.email = metadataInfos.at(5).toString(); 0061 info.phone = metadataInfos.at(6).toString(); 0062 info.webUrl = metadataInfos.at(7).toString(); 0063 } 0064 0065 return info; 0066 } 0067 0068 bool DMetadata::setCreatorContactInfo(const IptcCoreContactInfo& info) const 0069 { 0070 if (!supportXmp()) 0071 { 0072 return false; 0073 } 0074 0075 if (!info.city.isEmpty()) 0076 { 0077 if (!setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCity", info.city)) 0078 { 0079 return false; 0080 } 0081 } 0082 0083 if (!info.country.isEmpty()) 0084 { 0085 if (!setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrCtry", info.country)) 0086 { 0087 return false; 0088 } 0089 } 0090 0091 if (!info.address.isEmpty()) 0092 { 0093 if (!setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrExtadr", info.address)) 0094 { 0095 return false; 0096 } 0097 } 0098 0099 if (!info.postalCode.isEmpty()) 0100 { 0101 if (!setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrPcode", info.postalCode)) 0102 { 0103 return false; 0104 } 0105 } 0106 0107 if (!info.provinceState.isEmpty()) 0108 { 0109 if (!setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiAdrRegion", info.provinceState)) 0110 { 0111 return false; 0112 } 0113 } 0114 0115 if (!info.email.isEmpty()) 0116 { 0117 if (!setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiEmailWork", info.email)) 0118 { 0119 return false; 0120 } 0121 } 0122 0123 if (!info.phone.isEmpty()) 0124 { 0125 if (!setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiTelWork", info.phone)) 0126 { 0127 return false; 0128 } 0129 } 0130 0131 if (!info.webUrl.isEmpty()) 0132 { 0133 if (!setXmpTagString("Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:CiUrlWork", info.webUrl)) 0134 { 0135 return false; 0136 } 0137 } 0138 0139 return true; 0140 } 0141 0142 IptcCoreLocationInfo DMetadata::getIptcCoreLocation() const 0143 { 0144 MetadataFields fields; 0145 fields << MetadataInfo::IptcCoreCountry 0146 << MetadataInfo::IptcCoreCountryCode 0147 << MetadataInfo::IptcCoreCity 0148 << MetadataInfo::IptcCoreLocation 0149 << MetadataInfo::IptcCoreProvinceState; 0150 0151 QVariantList metadataInfos = getMetadataFields(fields); 0152 0153 IptcCoreLocationInfo location; 0154 0155 if (fields.size() == 5) 0156 { 0157 location.country = metadataInfos.at(0).toString(); 0158 location.countryCode = metadataInfos.at(1).toString(); 0159 location.city = metadataInfos.at(2).toString(); 0160 location.location = metadataInfos.at(3).toString(); 0161 location.provinceState = metadataInfos.at(4).toString(); 0162 } 0163 0164 return location; 0165 } 0166 0167 bool DMetadata::setIptcCoreLocation(const IptcCoreLocationInfo& location) const 0168 { 0169 if (supportXmp()) 0170 { 0171 if (!location.country.isEmpty()) 0172 { 0173 if (!setXmpTagString("Xmp.photoshop.Country", location.country)) 0174 { 0175 return false; 0176 } 0177 } 0178 0179 if (!location.countryCode.isEmpty()) 0180 { 0181 if (!setXmpTagString("Xmp.iptc.CountryCode", location.countryCode)) 0182 { 0183 return false; 0184 } 0185 } 0186 0187 if (!location.city.isEmpty()) 0188 { 0189 if (!setXmpTagString("Xmp.photoshop.City", location.city)) 0190 { 0191 return false; 0192 } 0193 } 0194 0195 if (!location.location.isEmpty()) 0196 { 0197 if (!setXmpTagString("Xmp.iptc.Location", location.location)) 0198 { 0199 return false; 0200 } 0201 } 0202 0203 if (!location.provinceState.isEmpty()) 0204 { 0205 if (!setXmpTagString("Xmp.photoshop.State", location.provinceState)) 0206 { 0207 return false; 0208 } 0209 } 0210 } 0211 0212 if (!location.country.isEmpty()) 0213 { 0214 if (!setIptcTag(location.country, 64, "Country", "Iptc.Application2.CountryName")) 0215 { 0216 return false; 0217 } 0218 } 0219 0220 if (!location.countryCode.isEmpty()) 0221 { 0222 if (!setIptcTag(location.countryCode, 3, "Country Code", "Iptc.Application2.CountryCode")) 0223 { 0224 return false; 0225 } 0226 } 0227 0228 if (!location.city.isEmpty()) 0229 { 0230 if (!setIptcTag(location.city, 32, "City", "Iptc.Application2.City")) 0231 { 0232 return false; 0233 } 0234 } 0235 0236 if (!location.location.isEmpty()) 0237 { 0238 if (!setIptcTag(location.location, 32, "SubLocation", "Iptc.Application2.SubLocation")) 0239 { 0240 return false; 0241 } 0242 } 0243 0244 if (!location.provinceState.isEmpty()) 0245 { 0246 if (!setIptcTag(location.provinceState, 32, "Province/State", "Iptc.Application2.ProvinceState")) 0247 { 0248 return false; 0249 } 0250 } 0251 0252 return true; 0253 } 0254 0255 QStringList DMetadata::getIptcCoreSubjects() const 0256 { 0257 QStringList list = getXmpSubjects(); 0258 0259 if (!list.isEmpty()) 0260 { 0261 return list; 0262 } 0263 0264 return getIptcSubjects(); 0265 } 0266 0267 bool DMetadata::setIptcTag(const QString& text, 0268 int maxLength, 0269 const char* const debugLabel, 0270 const char* const tagKey) const 0271 { 0272 QString truncatedText = text; 0273 truncatedText.truncate(maxLength); 0274 qCDebug(DIGIKAM_METAENGINE_LOG) << getFilePath() << " ==> " << debugLabel << ": " << truncatedText; 0275 0276 return setIptcTagString(tagKey, truncatedText); // returns false if failed 0277 } 0278 0279 QVariant DMetadata::fromIptcEmulateList(const char* const iptcTagName) const 0280 { 0281 return toStringListVariant(getIptcTagsStringList(iptcTagName)); 0282 } 0283 0284 QVariant DMetadata::fromIptcEmulateLangAlt(const char* const iptcTagName) const 0285 { 0286 QString str = getIptcTagString(iptcTagName); 0287 QMap<QString, QVariant> map; 0288 0289 if (str.isNull()) 0290 { 0291 0292 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) 0293 0294 return QVariant(QMetaType(QMetaType::QVariantMap)); 0295 0296 #else 0297 0298 return QVariant(QVariant::Map); 0299 0300 #endif 0301 0302 } 0303 0304 map[QLatin1String("x-default")] = str; 0305 0306 return map; 0307 } 0308 0309 bool DMetadata::removeIptcTags(const QStringList& tagFilters) 0310 { 0311 MetaDataMap m = getIptcTagsDataList(tagFilters); 0312 0313 if (m.isEmpty()) 0314 { 0315 return false; 0316 } 0317 0318 for (MetaDataMap::iterator it = m.begin() ; it != m.end() ; ++it) 0319 { 0320 removeIptcTag(it.key().toLatin1().constData()); 0321 } 0322 0323 return true; 0324 } 0325 0326 DMetadata::CountryCodeMap DMetadata::countryCodeMap() 0327 { 0328 CountryCodeMap countryCodeMap; 0329 0330 // All ISO 639-1 language code based on 2 characters 0331 // https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes 0332 0333 countryCodeMap.insert( QLatin1String("AA"), i18nc("@info: country code", "Afar")); 0334 countryCodeMap.insert( QLatin1String("AB"), i18nc("@info: country code", "Abkhazian")); 0335 countryCodeMap.insert( QLatin1String("AF"), i18nc("@info: country code", "Afrikaans")); 0336 countryCodeMap.insert( QLatin1String("AM"), i18nc("@info: country code", "Amharic")); 0337 countryCodeMap.insert( QLatin1String("AR"), i18nc("@info: country code", "Arabic")); 0338 countryCodeMap.insert( QLatin1String("AS"), i18nc("@info: country code", "Assamese")); 0339 countryCodeMap.insert( QLatin1String("AY"), i18nc("@info: country code", "Aymara")); 0340 countryCodeMap.insert( QLatin1String("AZ"), i18nc("@info: country code", "Azerbaijani")); 0341 countryCodeMap.insert( QLatin1String("BA"), i18nc("@info: country code", "Bashkir")); 0342 countryCodeMap.insert( QLatin1String("BE"), i18nc("@info: country code", "Byelorussian")); 0343 countryCodeMap.insert( QLatin1String("BG"), i18nc("@info: country code", "Bulgarian")); 0344 countryCodeMap.insert( QLatin1String("BH"), i18nc("@info: country code", "Bihari")); 0345 countryCodeMap.insert( QLatin1String("BI"), i18nc("@info: country code", "Bislama")); 0346 countryCodeMap.insert( QLatin1String("BN"), i18nc("@info: country code", "Bengali;Bangla") ); 0347 countryCodeMap.insert( QLatin1String("BO"), i18nc("@info: country code", "Tibetan")); 0348 countryCodeMap.insert( QLatin1String("BR"), i18nc("@info: country code", "Breton")); 0349 countryCodeMap.insert( QLatin1String("CA"), i18nc("@info: country code", "Catalan")); 0350 countryCodeMap.insert( QLatin1String("CO"), i18nc("@info: country code", "Corsican")); 0351 countryCodeMap.insert( QLatin1String("CS"), i18nc("@info: country code", "Czech")); 0352 countryCodeMap.insert( QLatin1String("CY"), i18nc("@info: country code", "Welsh")); 0353 countryCodeMap.insert( QLatin1String("DA"), i18nc("@info: country code", "Danish")); 0354 countryCodeMap.insert( QLatin1String("DE"), i18nc("@info: country code", "German")); 0355 countryCodeMap.insert( QLatin1String("DZ"), i18nc("@info: country code", "Dzongkha")); 0356 countryCodeMap.insert( QLatin1String("EL"), i18nc("@info: country code", "Greek")); 0357 countryCodeMap.insert( QLatin1String("EN"), i18nc("@info: country code", "English")); 0358 countryCodeMap.insert( QLatin1String("EO"), i18nc("@info: country code", "Esperanto")); 0359 countryCodeMap.insert( QLatin1String("ES"), i18nc("@info: country code", "Spanish")); 0360 countryCodeMap.insert( QLatin1String("ET"), i18nc("@info: country code", "Estonian")); 0361 countryCodeMap.insert( QLatin1String("EU"), i18nc("@info: country code", "Basque")); 0362 countryCodeMap.insert( QLatin1String("FA"), i18nc("@info: country code", "Persian(farsi)") ); 0363 countryCodeMap.insert( QLatin1String("FI"), i18nc("@info: country code", "Finnish")); 0364 countryCodeMap.insert( QLatin1String("FJ"), i18nc("@info: country code", "Fijan")); 0365 countryCodeMap.insert( QLatin1String("FO"), i18nc("@info: country code", "Faroese") ); 0366 countryCodeMap.insert( QLatin1String("FR"), i18nc("@info: country code", "French") ); 0367 countryCodeMap.insert( QLatin1String("FY"), i18nc("@info: country code", "Frisian") ); 0368 countryCodeMap.insert( QLatin1String("GA"), i18nc("@info: country code", "Irish") ); 0369 countryCodeMap.insert( QLatin1String("GD"), i18nc("@info: country code", "Scotsgaelic") ); 0370 countryCodeMap.insert( QLatin1String("GL"), i18nc("@info: country code", "Galician") ); 0371 countryCodeMap.insert( QLatin1String("GN"), i18nc("@info: country code", "Guarani") ); 0372 countryCodeMap.insert( QLatin1String("GU"), i18nc("@info: country code", "Gujarati") ); 0373 countryCodeMap.insert( QLatin1String("HA"), i18nc("@info: country code", "Hausa") ); 0374 countryCodeMap.insert( QLatin1String("HE"), i18nc("@info: country code", "Hebrew") ); 0375 countryCodeMap.insert( QLatin1String("HI"), i18nc("@info: country code", "Hindi") ); 0376 countryCodeMap.insert( QLatin1String("HR"), i18nc("@info: country code", "Croatian") ); 0377 countryCodeMap.insert( QLatin1String("HU"), i18nc("@info: country code", "Hungarian") ); 0378 countryCodeMap.insert( QLatin1String("HY"), i18nc("@info: country code", "Armenian") ); 0379 countryCodeMap.insert( QLatin1String("IA"), i18nc("@info: country code", "Interlingua") ); 0380 countryCodeMap.insert( QLatin1String("IE"), i18nc("@info: country code", "Interlingue") ); 0381 countryCodeMap.insert( QLatin1String("IK"), i18nc("@info: country code", "Inupiak") ); 0382 countryCodeMap.insert( QLatin1String("ID"), i18nc("@info: country code", "Indonesian") ); 0383 countryCodeMap.insert( QLatin1String("IS"), i18nc("@info: country code", "Icelandic") ); 0384 countryCodeMap.insert( QLatin1String("IT"), i18nc("@info: country code", "Italian") ); 0385 countryCodeMap.insert( QLatin1String("IU"), i18nc("@info: country code", "Inuktitut") ); 0386 countryCodeMap.insert( QLatin1String("JA"), i18nc("@info: country code", "Japanese") ); 0387 countryCodeMap.insert( QLatin1String("JV"), i18nc("@info: country code", "Javanese") ); 0388 countryCodeMap.insert( QLatin1String("KA"), i18nc("@info: country code", "Georgian") ); 0389 countryCodeMap.insert( QLatin1String("KK"), i18nc("@info: country code", "Kazakh") ); 0390 countryCodeMap.insert( QLatin1String("KL"), i18nc("@info: country code", "Greenlandic") ); 0391 countryCodeMap.insert( QLatin1String("KM"), i18nc("@info: country code", "Cambodian") ); 0392 countryCodeMap.insert( QLatin1String("KN"), i18nc("@info: country code", "Kannada") ); 0393 countryCodeMap.insert( QLatin1String("KO"), i18nc("@info: country code", "Korean") ); 0394 countryCodeMap.insert( QLatin1String("KS"), i18nc("@info: country code", "Kashmiri") ); 0395 countryCodeMap.insert( QLatin1String("KU"), i18nc("@info: country code", "Kurdish") ); 0396 countryCodeMap.insert( QLatin1String("KY"), i18nc("@info: country code", "Kirghiz") ); 0397 countryCodeMap.insert( QLatin1String("LA"), i18nc("@info: country code", "Latin") ); 0398 countryCodeMap.insert( QLatin1String("LN"), i18nc("@info: country code", "Lingala") ); 0399 countryCodeMap.insert( QLatin1String("LO"), i18nc("@info: country code", "Laothian") ); 0400 countryCodeMap.insert( QLatin1String("LT"), i18nc("@info: country code", "Lithuanian") ); 0401 countryCodeMap.insert( QLatin1String("LV"), i18nc("@info: country code", "Latvian;Lettish") ); 0402 countryCodeMap.insert( QLatin1String("MG"), i18nc("@info: country code", "Malagasy") ); 0403 countryCodeMap.insert( QLatin1String("MI"), i18nc("@info: country code", "Maori") ); 0404 countryCodeMap.insert( QLatin1String("MK"), i18nc("@info: country code", "Macedonian") ); 0405 countryCodeMap.insert( QLatin1String("ML"), i18nc("@info: country code", "Malayalam") ); 0406 countryCodeMap.insert( QLatin1String("MN"), i18nc("@info: country code", "Mongolian") ); 0407 countryCodeMap.insert( QLatin1String("MR"), i18nc("@info: country code", "Marathi") ); 0408 countryCodeMap.insert( QLatin1String("MS"), i18nc("@info: country code", "Malay") ); 0409 countryCodeMap.insert( QLatin1String("MT"), i18nc("@info: country code", "Maltese") ); 0410 countryCodeMap.insert( QLatin1String("MY"), i18nc("@info: country code", "Burmese") ); 0411 countryCodeMap.insert( QLatin1String("NA"), i18nc("@info: country code", "Nauru") ); 0412 countryCodeMap.insert( QLatin1String("NE"), i18nc("@info: country code", "Nepali") ); 0413 countryCodeMap.insert( QLatin1String("NL"), i18nc("@info: country code", "Dutch") ); 0414 countryCodeMap.insert( QLatin1String("NO"), i18nc("@info: country code", "Norwegian") ); 0415 countryCodeMap.insert( QLatin1String("OC"), i18nc("@info: country code", "Occitan") ); 0416 countryCodeMap.insert( QLatin1String("OM"), i18nc("@info: country code", "Oromo") ); 0417 countryCodeMap.insert( QLatin1String("OR"), i18nc("@info: country code", "Oriya") ); 0418 countryCodeMap.insert( QLatin1String("PA"), i18nc("@info: country code", "Punjabi") ); 0419 countryCodeMap.insert( QLatin1String("PL"), i18nc("@info: country code", "Polish") ); 0420 countryCodeMap.insert( QLatin1String("PS"), i18nc("@info: country code", "Pashto;Pushto") ); 0421 countryCodeMap.insert( QLatin1String("PT"), i18nc("@info: country code", "Portuguese") ); 0422 countryCodeMap.insert( QLatin1String("QU"), i18nc("@info: country code", "Quechua") ); 0423 countryCodeMap.insert( QLatin1String("RM"), i18nc("@info: country code", "Rhaeto-romance") ); 0424 countryCodeMap.insert( QLatin1String("RN"), i18nc("@info: country code", "Kurundi") ); 0425 countryCodeMap.insert( QLatin1String("RO"), i18nc("@info: country code", "Romanian") ); 0426 countryCodeMap.insert( QLatin1String("RU"), i18nc("@info: country code", "Russian") ); 0427 countryCodeMap.insert( QLatin1String("RW"), i18nc("@info: country code", "Kinyarwanda") ); 0428 countryCodeMap.insert( QLatin1String("SA"), i18nc("@info: country code", "Sanskrit") ); 0429 countryCodeMap.insert( QLatin1String("SD"), i18nc("@info: country code", "Sindhi") ); 0430 countryCodeMap.insert( QLatin1String("SG"), i18nc("@info: country code", "Sangho") ); 0431 countryCodeMap.insert( QLatin1String("SI"), i18nc("@info: country code", "Singhalese") ); 0432 countryCodeMap.insert( QLatin1String("SK"), i18nc("@info: country code", "Slovak") ); 0433 countryCodeMap.insert( QLatin1String("SL"), i18nc("@info: country code", "Slovenian") ); 0434 countryCodeMap.insert( QLatin1String("SM"), i18nc("@info: country code", "Samoan") ); 0435 countryCodeMap.insert( QLatin1String("SN"), i18nc("@info: country code", "Shona") ); 0436 countryCodeMap.insert( QLatin1String("SO"), i18nc("@info: country code", "Somali") ); 0437 countryCodeMap.insert( QLatin1String("SQ"), i18nc("@info: country code", "Albanian") ); 0438 countryCodeMap.insert( QLatin1String("SR"), i18nc("@info: country code", "Serbian") ); 0439 countryCodeMap.insert( QLatin1String("SS"), i18nc("@info: country code", "Siswati") ); 0440 countryCodeMap.insert( QLatin1String("ST"), i18nc("@info: country code", "Sesotho") ); 0441 countryCodeMap.insert( QLatin1String("SU"), i18nc("@info: country code", "Sundanese") ); 0442 countryCodeMap.insert( QLatin1String("SV"), i18nc("@info: country code", "Swedish") ); 0443 countryCodeMap.insert( QLatin1String("SW"), i18nc("@info: country code", "Swahili") ); 0444 countryCodeMap.insert( QLatin1String("TA"), i18nc("@info: country code", "Tamil") ); 0445 countryCodeMap.insert( QLatin1String("TE"), i18nc("@info: country code", "Telugu") ); 0446 countryCodeMap.insert( QLatin1String("TG"), i18nc("@info: country code", "Tajik") ); 0447 countryCodeMap.insert( QLatin1String("TH"), i18nc("@info: country code", "Thai") ); 0448 countryCodeMap.insert( QLatin1String("TI"), i18nc("@info: country code", "Tigrinya") ); 0449 countryCodeMap.insert( QLatin1String("TK"), i18nc("@info: country code", "Turkmen") ); 0450 countryCodeMap.insert( QLatin1String("TL"), i18nc("@info: country code", "Tagalog") ); 0451 countryCodeMap.insert( QLatin1String("TN"), i18nc("@info: country code", "Setswana") ); 0452 countryCodeMap.insert( QLatin1String("TO"), i18nc("@info: country code", "Tonga") ); 0453 countryCodeMap.insert( QLatin1String("TR"), i18nc("@info: country code", "Turkish") ); 0454 countryCodeMap.insert( QLatin1String("TS"), i18nc("@info: country code", "Tsonga") ); 0455 countryCodeMap.insert( QLatin1String("TT"), i18nc("@info: country code", "Tatar") ); 0456 countryCodeMap.insert( QLatin1String("TW"), i18nc("@info: country code", "Twi") ); 0457 countryCodeMap.insert( QLatin1String("UG"), i18nc("@info: country code", "Uigur") ); 0458 countryCodeMap.insert( QLatin1String("UK"), i18nc("@info: country code", "Ukrainian") ); 0459 countryCodeMap.insert( QLatin1String("UR"), i18nc("@info: country code", "Urdu") ); 0460 countryCodeMap.insert( QLatin1String("UZ"), i18nc("@info: country code", "Uzbek") ); 0461 countryCodeMap.insert( QLatin1String("VI"), i18nc("@info: country code", "Vietnamese") ); 0462 countryCodeMap.insert( QLatin1String("VO"), i18nc("@info: country code", "Volapuk") ); 0463 countryCodeMap.insert( QLatin1String("WO"), i18nc("@info: country code", "Wolof") ); 0464 countryCodeMap.insert( QLatin1String("XH"), i18nc("@info: country code", "Xhosa") ); 0465 countryCodeMap.insert( QLatin1String("YI"), i18nc("@info: country code", "Yiddish") ); 0466 countryCodeMap.insert( QLatin1String("YO"), i18nc("@info: country code", "Yoruba") ); 0467 countryCodeMap.insert( QLatin1String("ZA"), i18nc("@info: country code", "Zhuang") ); 0468 countryCodeMap.insert( QLatin1String("ZH"), i18nc("@info: country code", "Chinese") ); 0469 countryCodeMap.insert( QLatin1String("ZU"), i18nc("@info: country code", "Zulu") ); 0470 0471 return countryCodeMap; 0472 } 0473 0474 DMetadata::CountryCodeMap DMetadata::countryCodeMap2() 0475 { 0476 CountryCodeMap countryCodeMap; 0477 0478 // All ISO 639-2 language code based on 2 characters 0479 // https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes 0480 0481 countryCodeMap.insert( QLatin1String("aar"), i18nc("@info: country code", "Afar")); 0482 countryCodeMap.insert( QLatin1String("abk"), i18nc("@info: country code", "Abkhazian")); 0483 countryCodeMap.insert( QLatin1String("afr"), i18nc("@info: country code", "Afrikaans")); 0484 countryCodeMap.insert( QLatin1String("amh"), i18nc("@info: country code", "Amharic")); 0485 countryCodeMap.insert( QLatin1String("ara"), i18nc("@info: country code", "Arabic")); 0486 countryCodeMap.insert( QLatin1String("asm"), i18nc("@info: country code", "Assamese")); 0487 countryCodeMap.insert( QLatin1String("aym"), i18nc("@info: country code", "Aymara")); 0488 countryCodeMap.insert( QLatin1String("aze"), i18nc("@info: country code", "Azerbaijani")); 0489 countryCodeMap.insert( QLatin1String("bak"), i18nc("@info: country code", "Bashkir")); 0490 countryCodeMap.insert( QLatin1String("bel"), i18nc("@info: country code", "Byelorussian")); 0491 countryCodeMap.insert( QLatin1String("bul"), i18nc("@info: country code", "Bulgarian")); 0492 countryCodeMap.insert( QLatin1String("bih"), i18nc("@info: country code", "Bihari")); 0493 countryCodeMap.insert( QLatin1String("bis"), i18nc("@info: country code", "Bislama")); 0494 countryCodeMap.insert( QLatin1String("ben"), i18nc("@info: country code", "Bengali;Bangla") ); 0495 countryCodeMap.insert( QLatin1String("bod"), i18nc("@info: country code", "Tibetan")); 0496 countryCodeMap.insert( QLatin1String("bre"), i18nc("@info: country code", "Breton")); 0497 countryCodeMap.insert( QLatin1String("cat"), i18nc("@info: country code", "Catalan")); 0498 countryCodeMap.insert( QLatin1String("cos"), i18nc("@info: country code", "Corsican")); 0499 countryCodeMap.insert( QLatin1String("ces"), i18nc("@info: country code", "Czech")); 0500 countryCodeMap.insert( QLatin1String("cym"), i18nc("@info: country code", "Welsh")); 0501 countryCodeMap.insert( QLatin1String("dan"), i18nc("@info: country code", "Danish")); 0502 countryCodeMap.insert( QLatin1String("deu"), i18nc("@info: country code", "German")); 0503 countryCodeMap.insert( QLatin1String("dzo"), i18nc("@info: country code", "Dzongkha")); 0504 countryCodeMap.insert( QLatin1String("ell"), i18nc("@info: country code", "Greek")); 0505 countryCodeMap.insert( QLatin1String("eng"), i18nc("@info: country code", "English")); 0506 countryCodeMap.insert( QLatin1String("epo"), i18nc("@info: country code", "Esperanto")); 0507 countryCodeMap.insert( QLatin1String("spa"), i18nc("@info: country code", "Spanish")); 0508 countryCodeMap.insert( QLatin1String("est"), i18nc("@info: country code", "Estonian")); 0509 countryCodeMap.insert( QLatin1String("eus"), i18nc("@info: country code", "Basque")); 0510 countryCodeMap.insert( QLatin1String("fas"), i18nc("@info: country code", "Persian(farsi)") ); 0511 countryCodeMap.insert( QLatin1String("fin"), i18nc("@info: country code", "Finnish")); 0512 countryCodeMap.insert( QLatin1String("fij"), i18nc("@info: country code", "Fijan")); 0513 countryCodeMap.insert( QLatin1String("fao"), i18nc("@info: country code", "Faroese") ); 0514 countryCodeMap.insert( QLatin1String("fra"), i18nc("@info: country code", "French") ); 0515 countryCodeMap.insert( QLatin1String("fry"), i18nc("@info: country code", "Frisian") ); 0516 countryCodeMap.insert( QLatin1String("gle"), i18nc("@info: country code", "Irish") ); 0517 countryCodeMap.insert( QLatin1String("gla"), i18nc("@info: country code", "Scotsgaelic") ); 0518 countryCodeMap.insert( QLatin1String("glg"), i18nc("@info: country code", "Galician") ); 0519 countryCodeMap.insert( QLatin1String("grn"), i18nc("@info: country code", "Guarani") ); 0520 countryCodeMap.insert( QLatin1String("guj"), i18nc("@info: country code", "Gujarati") ); 0521 countryCodeMap.insert( QLatin1String("hau"), i18nc("@info: country code", "Hausa") ); 0522 countryCodeMap.insert( QLatin1String("heb"), i18nc("@info: country code", "Hebrew") ); 0523 countryCodeMap.insert( QLatin1String("hin"), i18nc("@info: country code", "Hindi") ); 0524 countryCodeMap.insert( QLatin1String("hrv"), i18nc("@info: country code", "Croatian") ); 0525 countryCodeMap.insert( QLatin1String("hun"), i18nc("@info: country code", "Hungarian") ); 0526 countryCodeMap.insert( QLatin1String("hye"), i18nc("@info: country code", "Armenian") ); 0527 countryCodeMap.insert( QLatin1String("ina"), i18nc("@info: country code", "Interlingua") ); 0528 countryCodeMap.insert( QLatin1String("ile"), i18nc("@info: country code", "Interlingue") ); 0529 countryCodeMap.insert( QLatin1String("ipk"), i18nc("@info: country code", "Inupiak") ); 0530 countryCodeMap.insert( QLatin1String("ind"), i18nc("@info: country code", "Indonesian") ); 0531 countryCodeMap.insert( QLatin1String("isl"), i18nc("@info: country code", "Icelandic") ); 0532 countryCodeMap.insert( QLatin1String("ita"), i18nc("@info: country code", "Italian") ); 0533 countryCodeMap.insert( QLatin1String("iku"), i18nc("@info: country code", "Inuktitut") ); 0534 countryCodeMap.insert( QLatin1String("jpn"), i18nc("@info: country code", "Japanese") ); 0535 countryCodeMap.insert( QLatin1String("jav"), i18nc("@info: country code", "Javanese") ); 0536 countryCodeMap.insert( QLatin1String("kat"), i18nc("@info: country code", "Georgian") ); 0537 countryCodeMap.insert( QLatin1String("kaz"), i18nc("@info: country code", "Kazakh") ); 0538 countryCodeMap.insert( QLatin1String("kal"), i18nc("@info: country code", "Greenlandic") ); 0539 countryCodeMap.insert( QLatin1String("khm"), i18nc("@info: country code", "Cambodian") ); 0540 countryCodeMap.insert( QLatin1String("kan"), i18nc("@info: country code", "Kannada") ); 0541 countryCodeMap.insert( QLatin1String("kor"), i18nc("@info: country code", "Korean") ); 0542 countryCodeMap.insert( QLatin1String("kas"), i18nc("@info: country code", "Kashmiri") ); 0543 countryCodeMap.insert( QLatin1String("kur"), i18nc("@info: country code", "Kurdish") ); 0544 countryCodeMap.insert( QLatin1String("kir"), i18nc("@info: country code", "Kirghiz") ); 0545 countryCodeMap.insert( QLatin1String("lat"), i18nc("@info: country code", "Latin") ); 0546 countryCodeMap.insert( QLatin1String("lin"), i18nc("@info: country code", "Lingala") ); 0547 countryCodeMap.insert( QLatin1String("lao"), i18nc("@info: country code", "Laothian") ); 0548 countryCodeMap.insert( QLatin1String("lit"), i18nc("@info: country code", "Lithuanian") ); 0549 countryCodeMap.insert( QLatin1String("lav"), i18nc("@info: country code", "Latvian;Lettish") ); 0550 countryCodeMap.insert( QLatin1String("mlg"), i18nc("@info: country code", "Malagasy") ); 0551 countryCodeMap.insert( QLatin1String("mri"), i18nc("@info: country code", "Maori") ); 0552 countryCodeMap.insert( QLatin1String("mkd"), i18nc("@info: country code", "Macedonian") ); 0553 countryCodeMap.insert( QLatin1String("mal"), i18nc("@info: country code", "Malayalam") ); 0554 countryCodeMap.insert( QLatin1String("mon"), i18nc("@info: country code", "Mongolian") ); 0555 countryCodeMap.insert( QLatin1String("mar"), i18nc("@info: country code", "Marathi") ); 0556 countryCodeMap.insert( QLatin1String("msa"), i18nc("@info: country code", "Malay") ); 0557 countryCodeMap.insert( QLatin1String("mlt"), i18nc("@info: country code", "Maltese") ); 0558 countryCodeMap.insert( QLatin1String("mya"), i18nc("@info: country code", "Burmese") ); 0559 countryCodeMap.insert( QLatin1String("nau"), i18nc("@info: country code", "Nauru") ); 0560 countryCodeMap.insert( QLatin1String("nep"), i18nc("@info: country code", "Nepali") ); 0561 countryCodeMap.insert( QLatin1String("nld"), i18nc("@info: country code", "Dutch") ); 0562 countryCodeMap.insert( QLatin1String("nor"), i18nc("@info: country code", "Norwegian") ); 0563 countryCodeMap.insert( QLatin1String("oci"), i18nc("@info: country code", "Occitan") ); 0564 countryCodeMap.insert( QLatin1String("orm"), i18nc("@info: country code", "Oromo") ); 0565 countryCodeMap.insert( QLatin1String("ori"), i18nc("@info: country code", "Oriya") ); 0566 countryCodeMap.insert( QLatin1String("pan"), i18nc("@info: country code", "Punjabi") ); 0567 countryCodeMap.insert( QLatin1String("pol"), i18nc("@info: country code", "Polish") ); 0568 countryCodeMap.insert( QLatin1String("pus"), i18nc("@info: country code", "Pashto;Pushto") ); 0569 countryCodeMap.insert( QLatin1String("por"), i18nc("@info: country code", "Portuguese") ); 0570 countryCodeMap.insert( QLatin1String("que"), i18nc("@info: country code", "Quechua") ); 0571 countryCodeMap.insert( QLatin1String("roh"), i18nc("@info: country code", "Rhaeto-romance") ); 0572 countryCodeMap.insert( QLatin1String("run"), i18nc("@info: country code", "Kurundi") ); 0573 countryCodeMap.insert( QLatin1String("ron"), i18nc("@info: country code", "Romanian") ); 0574 countryCodeMap.insert( QLatin1String("rus"), i18nc("@info: country code", "Russian") ); 0575 countryCodeMap.insert( QLatin1String("kin"), i18nc("@info: country code", "Kinyarwanda") ); 0576 countryCodeMap.insert( QLatin1String("san"), i18nc("@info: country code", "Sanskrit") ); 0577 countryCodeMap.insert( QLatin1String("snd"), i18nc("@info: country code", "Sindhi") ); 0578 countryCodeMap.insert( QLatin1String("sag"), i18nc("@info: country code", "Sangho") ); 0579 countryCodeMap.insert( QLatin1String("sin"), i18nc("@info: country code", "Singhalese") ); 0580 countryCodeMap.insert( QLatin1String("slk"), i18nc("@info: country code", "Slovak") ); 0581 countryCodeMap.insert( QLatin1String("slv"), i18nc("@info: country code", "Slovenian") ); 0582 countryCodeMap.insert( QLatin1String("smo"), i18nc("@info: country code", "Samoan") ); 0583 countryCodeMap.insert( QLatin1String("sna"), i18nc("@info: country code", "Shona") ); 0584 countryCodeMap.insert( QLatin1String("som"), i18nc("@info: country code", "Somali") ); 0585 countryCodeMap.insert( QLatin1String("sqi"), i18nc("@info: country code", "Albanian") ); 0586 countryCodeMap.insert( QLatin1String("srp"), i18nc("@info: country code", "Serbian") ); 0587 countryCodeMap.insert( QLatin1String("ssw"), i18nc("@info: country code", "Siswati") ); 0588 countryCodeMap.insert( QLatin1String("sot"), i18nc("@info: country code", "Sesotho") ); 0589 countryCodeMap.insert( QLatin1String("sun"), i18nc("@info: country code", "Sundanese") ); 0590 countryCodeMap.insert( QLatin1String("swe"), i18nc("@info: country code", "Swedish") ); 0591 countryCodeMap.insert( QLatin1String("swa"), i18nc("@info: country code", "Swahili") ); 0592 countryCodeMap.insert( QLatin1String("tam"), i18nc("@info: country code", "Tamil") ); 0593 countryCodeMap.insert( QLatin1String("tel"), i18nc("@info: country code", "Telugu") ); 0594 countryCodeMap.insert( QLatin1String("tgk"), i18nc("@info: country code", "Tajik") ); 0595 countryCodeMap.insert( QLatin1String("tha"), i18nc("@info: country code", "Thai") ); 0596 countryCodeMap.insert( QLatin1String("tir"), i18nc("@info: country code", "Tigrinya") ); 0597 countryCodeMap.insert( QLatin1String("tuk"), i18nc("@info: country code", "Turkmen") ); 0598 countryCodeMap.insert( QLatin1String("tgl"), i18nc("@info: country code", "Tagalog") ); 0599 countryCodeMap.insert( QLatin1String("tsn"), i18nc("@info: country code", "Setswana") ); 0600 countryCodeMap.insert( QLatin1String("ton"), i18nc("@info: country code", "Tonga") ); 0601 countryCodeMap.insert( QLatin1String("tur"), i18nc("@info: country code", "Turkish") ); 0602 countryCodeMap.insert( QLatin1String("tso"), i18nc("@info: country code", "Tsonga") ); 0603 countryCodeMap.insert( QLatin1String("tat"), i18nc("@info: country code", "Tatar") ); 0604 countryCodeMap.insert( QLatin1String("twi"), i18nc("@info: country code", "Twi") ); 0605 countryCodeMap.insert( QLatin1String("uig"), i18nc("@info: country code", "Uigur") ); 0606 countryCodeMap.insert( QLatin1String("ukr"), i18nc("@info: country code", "Ukrainian") ); 0607 countryCodeMap.insert( QLatin1String("urd"), i18nc("@info: country code", "Urdu") ); 0608 countryCodeMap.insert( QLatin1String("uzb"), i18nc("@info: country code", "Uzbek") ); 0609 countryCodeMap.insert( QLatin1String("vie"), i18nc("@info: country code", "Vietnamese") ); 0610 countryCodeMap.insert( QLatin1String("vol"), i18nc("@info: country code", "Volapuk") ); 0611 countryCodeMap.insert( QLatin1String("wol"), i18nc("@info: country code", "Wolof") ); 0612 countryCodeMap.insert( QLatin1String("xho"), i18nc("@info: country code", "Xhosa") ); 0613 countryCodeMap.insert( QLatin1String("yid"), i18nc("@info: country code", "Yiddish") ); 0614 countryCodeMap.insert( QLatin1String("yor"), i18nc("@info: country code", "Yoruba") ); 0615 countryCodeMap.insert( QLatin1String("zha"), i18nc("@info: country code", "Zhuang") ); 0616 countryCodeMap.insert( QLatin1String("zho"), i18nc("@info: country code", "Chinese") ); 0617 countryCodeMap.insert( QLatin1String("zul"), i18nc("@info: country code", "Zulu") ); 0618 0619 return countryCodeMap; 0620 } 0621 0622 } // namespace Digikam