6

How can one translate QGIS processing scripts GUI and user messages to other languages ?

The QGIS documentation explains how to translate Python plugins, but not processing scripts.

2
  • I don't understand how that could possibly work. You can't change the script language - it's a programming language, not a natural language. You can't translate it, unless you rewrite it in a different programming language.
    – jbalk
    Commented Nov 23, 2021 at 19:52
  • 4
    We're talking about internationalization support here : processing script description, full name, text displayed to the user, ...
    – bonzinor
    Commented Nov 24, 2021 at 19:06

1 Answer 1

1

There might be better ways to achieve this, but if it's only for a handful of additional languages you can do something like this:

from qgis.PyQt.QtCore import QSettings

settings = QSettings()

description = 'description in English'
if settings.value('locale/userLocale')[0:2] == 'de':
  description = 'description in German'

print(description)
1
  • 1
    Thanks for your answer. It's a good workaround for the description text, but it's too heavy to set up for log messages and parameters names.
    – bonzinor
    Commented Mar 11, 2022 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.