openstreetmap / merkaartor

Home of Merkaartor, an openstreetmap mapping program.
http://merkaartor.be/
Other
290 stars 79 forks source link

Use native language names #250

Closed sikmir closed 3 years ago

Krakonos commented 3 years ago

Not entirely opposed, but I'd like to keep some languages denoted as not properly translated (some of them are really not). I couldn't find a way to automate that part. Any ideas?

sikmir commented 3 years ago

Not entirely opposed, but I'd like to keep some languages denoted as not properly translated (some of them are really not). I couldn't find a way to automate that part. Any ideas?

What about:

  ...
  auto code = filename.mid(baseName.length(), filename.length() - baseName.length() - 3);
  std::vector<std::string> less50Complete { "de_AT", "et", "fi", "pt", "sk", "vi", "zh_CN" };
  if (std::find(less50Complete.begin(), less50Complete.end(), code) != less50Complete.end()) {
    aBox->addItem(QString{QLatin1String("[less than 50% complete] ") + QLocale(code).nativeLanguageName()}, code);
  } else {
    aBox->addItem(QLocale(code).nativeLanguageName(), code);
  }
  ...

less50Complete list could be moved to CMake variable.

Krakonos commented 3 years ago

Sounds good. I think having two variables in cmake TRANSLATIONS_FULL and _PARTIAL would make sense, one language being in one of these only and file names generated from the codes. In this way, each language file is represented only once. I think removing the language lookup (directory traversal) could be removed from c++ and done only in CMake (either by a glob, or by specifying all the codes by hand).

sikmir commented 3 years ago

I'd like to keep some languages denoted as not properly translated (some of them are really not).

I'm just wondering what's the reason to keep almost not translated languages in release distribution?

It could be somehow useful for translator, but not for normal user. Production ready threshold could be at least 80%. What about excluding such incomplete translations from installation package? Translator can just put .qm file to translations path recognized by merkaartor to test interested translation.

Krakonos commented 3 years ago

No specific reason. You're right that they probably don't need to be distributed. Looking into the tx tool, there appears to be a way to only download some translations. So perhaps changing the workflow could be done in this way:

rm translations/merkaartor_*.ts tx pull --minimum-perc=X git status # and commit changes; some of the files may be dropped from repo at this point, due to the rm - if they dropped under the threshold

and modify the CMake to just glob translations_*.ts, omitting <50% code entirely, keeping the detection as you originally proposed it.

sikmir commented 3 years ago

Looking into the tx tool, there appears to be a way to only download some translations.

I've added minimum_perc = 50 to .tx/config.

Krakonos commented 3 years ago

Finally got around to review, I only have one question: is it necessary to have all the languages listed in .tx/config? I'm not honestly sure why they would be there, as my tx client never inserted them there nor did I.

sikmir commented 3 years ago

I only have one question: is it necessary to have all the languages listed in .tx/config?

I've removed them and it seems to work.

Krakonos commented 3 years ago

Merged, thanks for the contribution!