Hey all,
I was looking into ways that we might possibly start to get some basic
internationalization (i18n) in the IDE with translation files. Right now
the way it works (in case you're not familiar) is that strings in the C++
source that ought to appear in translation are wrapped in a special `tr`
macro (for example: `tr("File not found")`). At runtime Qt selects from one
of several translation files depending on the user's local, and uses that
to swap out translated strings.
We have a ton of strings that are already wrapped in `tr`, but so far
exactly 0 translations have been entered. Given that we have an
international audience I think it might be nice to work toward improving
that!
---
Right now we have a small guide I wrote that shows how to add translations
manually with Qt Linguist:
https://github.com/supercollider/supercollider/wiki/%5BWIP%5D-Developer-info-%28DEVELOPING.md%29#adding-ide-translations
However, it seemed to me that many pieces of the project could be easily
translated without human volunteer time. A quick search turned up the
Microsoft Language Portal (https://www.microsoft.com/en-us/language), which
lets you download huge archives (>1GB) of UI translations MS uses. I wrote
a quick script that converts these CSV files into a format call QPH (Qt
Phrase book) that Qt Linguist can use to perform automated translation. I
tested it out on the Chinese translations from MS and got a pretty nice
success rate - of the ~500 strings available for translation, this database
took care of 220! A random sample with Google Translate indicates that the
translations are accurate. Perhaps someone that is actually fluent in a
non-English language can try it and provide better feedback.
This is the license on the glossary. I'm not sure if I'm reading it
correctly, but it sounds like we can use this free of charge as long as we
include the notice:
---
PERMISSION NOTICE
The Microsoft “Terms of Use” (available at the www.microsoft.com website)
govern all glossary terms in this document (“Glossary Terms”). The
following supplemental terms and conditions also apply. If there is any
conflict between the Terms of Use and the following terms and conditions,
the following terms and conditions will take
Precedence over the Terms of Use.
1. No part of the Glossary Terms may be reproduced, adapted, distributed,
or transmitted in any form or by any means, electronic, mechanical, or
otherwise, including photocopying and entry into an information storage
and/or retrieval system, for any purpose without the prior express consent
of Microsoft Corporation.
2. You may use the Glossary Terms in the development of any application
software and you may also use the Glossary Terms for personal or
non-commercial purposes only without the prior written consent of Microsoft
Corporation, and only if all copies contain this Permission Notice and the
Microsoft copyright notice in the Terms of Use.
3. You are not permitted to make any modifications, deletions or additions
to the Glossary Terms.
4. Except as expressly set forth above, Microsoft’s publication of the
Glossary Terms does not grant any rights to use, distribute, or implement
any technology or intellectual property rights. All rights not expressly
granted herein are expressly reserved by Microsoft.
---
I was thinking also of ways we might be able to do this within sclang
(scsynth?), without having Qt as a dependency. An initial thought was:
1. We could write our own `sc_tr` macro akin to Qt's macro, and use it
similarly.
2. Write a script to scan source files for this macro and use it to
construct a `ts` file in exactly the same format Qt uses. Then we can
leverage Qt Linguist to provide translations!
3. Write a simple module that does the same things Qt is doing to switch
out translation strings at runtime.
This might also be a good place to hook in a "machine-readable" locale!
Sorry for the length of this email, a lot to talk about here. :)
-Brian
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.