-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposed RFC Feature: Internationalization Support #114
Comments
We've had some discussions in o3de/o3de#14287 |
Awesome feature, thanks for the rfc! An option for terminology that doesn't translate well is to just not translate that particular item until an appropriate translation is determined. Many products follow this model. Ideally I would want to see testing against at least 3 languages (english, chinese, and ???) but understand that may not be feasible. Also, there will be considerations for button sizing and alignment in the editor. Example german is known for long translations, japanese fonts tend to be taller. We will also need to test what kind of performance and memory impact this will have. |
I still think its a great idea to get the architecture in place and start making steps towards doing this. No reason not to start just because the road is long. The only point I'd like to try to make here is that we have a bunch of code that isn't necessarily based on Qt and still emits english errors and other text (such as the runtime, other tools potentially, python scripts). in which case we'd need to think of whether we want a separate mechanism for translating those, since putting Qt in them would probably not be okay from a license (GPL-3 vs Apache) situation. Its possible we could still use the same tags and macros, tooling (Lupdate, qt linguist) but use them without linking to qt. |
Thanks for your feedback :)
|
I had some discussion with @yuyihsu, @bhanuja-s(from UX team) and @AMZN-daimini recently. Combined with the above in this RFC, here are some conclusion related.
Should I edit this RFC directly? What should I do once the above 3 points are finished? Please let me know asap if there is any other suggestions. Thanks! For the sake of future discussion, I put the main contents of our discussion here.
|
Summary:
This feature proposes to implement internationalization in O3DE to support other languages besides English on UI.
What is the relevance of this feature?
O3DE only supports English on UI currently, which is not so friendly to users from other countries. Especially for new users who had never done 3D product development before, support for their native language might help them start with O3DE and understand the terminologies more easily.
The proposed solution implements internationalization support in O3DE. After this work, developers only need to add a new language type and translate strings that have already been extracted to support any other language as they want.
Feature design description:
Mechanism of QT's internationalization support is used in this feature. The basic flow is as follows (Chinese translation for example).
lupdate
in QT to extract tagged strings into translation files with .ts suffix.Directory Structure:
Information of the tagged string with file path and line number will be added into TS file.
Linguist
Tool in QT to translate tagged strings in translation files. Developers can also modify TS files directly.lrelease
in QT to compile the translation files with .qm suffix.Directory Structure:
qtbase
is added to locate translations for basic Qt modules, such as Qt Core, Qt GUI, Qt Network, and Qt WidgetsTechnical design description:
Internationalization with QT
Internationalization with QT supports most languages in use today, and and will work on all platforms as long as the system has fonts to render these writing systems installed.
Following APIs are mainly used:
Three tools in QT are used to generate translation files automatically:
Implementation in O3DE
Currently, some strings to be translated have been tagged using Object::tr(). Translators are loaded in EditorQtApplication::Initialize().
However, the current implementation only supports localization in Editor and Asset Browser, and strings not in subclasses of QObject can't be translated.
Step 1. Set Translators
Based on what has been done in O3DE, this proposal uses
m_translators
with typeQVector
to store translators.Step 2. Load & Unload Translators
Since the startup time of each process are actually different, translators are loaded in every module separately.
Translation.h
.Step 3. Tag
There are three types of strings to translate:
tr()
.QObject::tr()
orSubclassOfQObject::tr()
. In particular, QT can't be used in code of runtime.QT_TRANSLATE_NOOP
macro.Step 4. Extract
Strings tagged are extracted into corresponding TS files automatically.
add_translation_module
in cmake file of every module.Step 5. Translate
TS files are in type of XML. Translations can be added manually or using
Qt Linguist
tool.<translation> </translation>
, and the type will be removed indicating that translation of this string has been finished.After translation, TS files will be simplified and compiled into QM files with suffix
.qm
automatically. QM files are fast compact versions of TS files.Step 6. Read
tr()
orObject::tr()
can be read straightly.QT_TRANSLATE_NOOP
macro need to be called byQCoreApplication::translate()
.Language Setting
A new setting for language is also needed in
Editor Settings
for users to switch language. It's designed like the setting namedConsole Background
.Editor Settings
-General Editor Preferences
-General Settings
. Other languages will be added later.Work Plan
Tag strings
in Editor and Asset Processor.generate translation files
(TS and QM) automatically.Chinese
.load
the translation files at startup andunload
them at teardown.Editor Settings
.What are the advantages of the feature?
How will this be implemented or integrated into the O3DE environment?
CMake build files will be added in the first PR. No additional processing is required by developers.
How will users learn this feature?
Once this proposal is passed, documents will be provided for users and developers to learn this feature.
Are there any open questions?
QString str = tr("Loading level %1 ...").arg(levelName)
will be extracted and translated in TS file as:Potential User Experience Improvements
According to the user experience we have collected, there are two questions worth considered.
Editor needs to restart to change the display language currently. Since it takes a long time to launch Editor and Asset Processor, restarting may lead to poor user experience.
It's hard to translate some terminologies accurately for developers, and inappropriate translations may confuse users.
Both of the above two questions need UX design and technical support.
Title of window's name is used as the key to store its layout. When the display language changed, key of the window will also change and information of its layout will become invalid.
The text was updated successfully, but these errors were encountered: