kio: remove redundant languages overrides

the languages are BCP 47 codes, see:
https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.5

and the links that lead to the BCP 47 RFC. the replacements in the
provided file were kinda bogus (contain dash which they should not)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-20 02:56:18 +03:00
parent 86e76231c7
commit 55e6b1b591
3 changed files with 1 additions and 28 deletions

View file

@ -261,13 +261,6 @@ install(
DESTINATION ${KDE4_DBUS_INTERFACES_INSTALL_DIR}
)
install(
FILES
kio/accept-languages.codes
DESTINATION ${KDE4_CONFIG_INSTALL_DIR}
)
install(
FILES
kfile/images/yes.png

View file

@ -1,6 +0,0 @@
[ReplacementCodes]
nb=nb,no
nn=nn,no
sr@latin=sr-Latn,sr
sr=sr-Cyrl,sr
pt_BR=pt-BR,pt

View file

@ -622,27 +622,13 @@ QString KProtocolManager::acceptLanguagesHeader()
if (!languageList.contains(english))
languageList += english;
// Some languages may have web codes different from locale codes,
// read them from the config and insert in proper order.
KConfig acclangConf("accept-languages.codes", KConfig::NoGlobals);
KConfigGroup replacementCodes(&acclangConf, "ReplacementCodes");
QStringList languageListFinal;
Q_FOREACH (const QString &lang, languageList)
{
const QStringList langs = replacementCodes.readEntry(lang, QStringList());
if (langs.isEmpty())
languageListFinal += lang;
else
languageListFinal += langs;
}
// The header is composed of comma separated languages, with an optional
// associated priority estimate (q=1..0) defaulting to 1.
// As our language tags are already sorted by priority, we'll just decrease
// the value evenly
int prio = 10;
QString header;
Q_FOREACH (const QString &lang,languageListFinal) {
Q_FOREACH (const QString &lang,languageList) {
header += lang;
if (prio < 10) {
header += QL1S(";q=0.");