Machine translation

Hoang Tran hoangduytran1960 at googlemail.com
Mon Oct 23 23:13:53 BST 2023


Hello Lukasz,

I’m translating Krita using machine translation from within POEdit (purchased, PRO version) 

https://poedit.net/
Poedit Translation Editor
poedit.net

and it works great. I did turn on option to allow it to contribute my translations to the online TM, here are my options


And it gets very good as time goes on, remembering what I used before and I can choose translations I used in the past as it suggested to me, on the tab on the right (Suggestions). I do have to pay yearly subscription for the use of the translation service, but it’s not that expensive. I do recommend you to use POEdit. I also used this app for translating Inkscape and Blender as well, beside Krita.

Working on MacOS, I also use (a lot) the text replacements capability (In the keyboard settings). My list of shortcut is HUGE for Vietnamese, so I don’t have to retype the full words every time. I don’t know what operating system you use, but I do recommend MacOS (OSX, I use Sonoma, the latest).

I haven’t seen how the documentation is build for KDE but on Blender, there is. You can find it in the online documentation (https://docs.blender.org/manual/en/dev/contribute/translations/contribute.html). I think KDE should offer similar (I haven’t found out if KDE offered the same or not).

Working with PO file, you can download this list of requirements for Blender:

(python3 -m pip install requirements.txt)

% cat requirements.txt 
sphinx==7.1.2

# Sphinx dependencies that are important
Jinja2==3.1.2
Pygments==2.16.1
docutils==0.18.1
snowballstemmer==2.2.0
babel==2.12.1
requests==2.31.0

# Only needed for building translations.
sphinx-intl==2.1.0

# Only needed to match the theme used for the official documentation.
# Without this theme, the default theme will be used.
sphinx_rtd_theme==1.3.0rc1

# Only for convenience, allows live updating while editing RST files.
# Access by running:
#   make livehtml
sphinx-autobuild==2021.3.14

# Required for spell-checking
pyenchant


And you can make use of Python’s code from these libraries:

from sphinx_intl import catalog as c
from babel.messages import Catalog, Message

To read/write PO file, besides the msgmerge, msgfmt offered by ‘gettext’ c-libraries. I am making use lots of ‘re.compile’ to create patterns for recognising internal references, because I’m following the pattern from the Ukrainian interpreters (see here: https://docs.blender.org/manual/uk/4.1/index.html). 

The reason being is that I wanted Vietnamese having the same ability to track English equivalents as they read the translation, which will help them, over time, to recognise and remember English words. I use lots of HTML’s abbreviations to include English text within the translation, plus Vietnamese explainations, and thus I wrote lots of Python codes to support this. 

I use the building HTML document process offered by sphinx to write Python code to interact with the sphinx’s building process as an extension (https://www.sphinx-doc.org/en/master/extdev/appapi.html) to find the role of each text line, (ie. The node type used for each piece of text) to define which heading requires the English text to repeat after the translation (ie. <vietnamese translation> — <English origin>), and write this list out as a ‘repeat_entries.po’ so I can track which one needed to repeat or not. 

I originally imagined that I could use English word’s orders to replace the Vietnamese in using this Node structure offered by Sphinx, but that’s not the case, the order of Vietnamese is similar to French, meaning the adjectives are placed after the nouns where as English is the opposite, thus I ended up having to use the proper online machine translation which helps me to swap the word’s position automatically, but I still use the ‘repeat_entries.po’ from the building process (make gettext).

Besides, I use ‘vscode’ (https://code.visualstudio.com/download) as well and with this editor you can track changes of each code lines of the source code - I also download the GitHub source code repository of Blender, Inkscape, Krita 5.2 - (installing git and git blames extension), which is very helpful to find out the context of words that was used by the developers, and when changes taken place, who can I contact if I needed to. 

Using vscode also allowed me to write extension in ’typescript’ and acting as a client to my ‘fastapi/uvicorn’ local HTTP Python server (which load my PO file into memory as a dictionary) and install that extension locally so I can allocate a small keyboard shortcut to activate these command to ask server to perform for me (ie. Search and translate words/sentences, check the meaning etc..), very convenient.

Well, I hope that will help you somehow to make your translation work easier and more interesting.

Best regards,
Hoang Tran




> On 23 Oct 2023, at 17:14, Łukasz Wojniłowicz <lukasz.wojnilowicz at gmail.com> wrote:
> 
> Hi all,
> 
> anyone used machine translation with KDE, and can recommend something?
> 
> Cheers
> Łukasz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-i18n-doc/attachments/20231023/37fa6598/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: og-image.jpg
Type: image/jpeg
Size: 87511 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-i18n-doc/attachments/20231023/37fa6598/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2023-10-23 at 22.14.56.png
Type: image/png
Size: 163401 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-i18n-doc/attachments/20231023/37fa6598/attachment-0001.png>


More information about the kde-i18n-doc mailing list