Comments (4)
On the localization topic there is nothing concrete yet. But it will be important for OrbTk. We have to check what are the possibilities and what we could well integrate. So I'm glade for each input and experience. I will create an localization feature request soon, to keep it on track.
from orbtk.
I would like to help, I have many ideas, the first would be to write an app, let's call it OrbLingo, it will manage the text version of the po file, depending on i18, or i20, and using a Google Translation account, will populate all the fields, and create all the po files, for all the selected languages.
How to get the data that needs to be translated is the biggest issue, the best way is up to you, but there is some things to keep in mind, you one have a message id and the message, using the English string as a msgid is a bad idea for so many reasons, so enforcing a msgid will make it easier to port back-wards, but there is always a trade-off, let me give you an example, say you do not alter your code for input strings, so where the API had you put in a string, you still do, you can use the strings as a key, but here is the problem with this approach, a msgid is a key, you use it to look up phrase, say we have an input of "Hello World", and somewhere else we have a "Hello World!", or "Hellow World", get my point, if you specify in the documents to use unique keys, you can make a key say "HELLO_WORLD", and when you make your translations automated via Google Translate, you can pick which langage to use to translate from, and it is not dependent on the translation coming from English for example, so it forces the user using the API, to make a spreadsheet or something to keep track of the keys, and that is what OrbLingo will do, help you make msgid and manage translations, it can look at the test logs to find missing keys, and add new ones.
This approach eliminates the need for multiple translations, that you pay by the word to Google to translate, and helps eliminate errors, and separates the code from the translation. The concept is you have a set of files that makes calls that uses some text, in the back-end of OrbTk, you hook that call, and write a test for it, that outputs its content to a file, AKA test log, with some metadata that makes it easy to parse, then you can use a database to keep all the translations in, and with a click of a button, you can create all the po files, and compile them into a mo file.
There are two projects I like gettext, and Fluent, both have their pros and cons.
You can make this a Plugin, that way you are not tied to any one project.
As such, all you need to do is write a mutable hook for every call that needs to be translated, and all it has to do is return the msgstr, or the original message. This approach allows you to write it without breaking anything, you can just add a fake plugin that just echos.
How to populate the po file in the first place is always the biggest issue, I have no idea if this is possible, but what about using the test or doc feature of rustc or cargo, and parse it, if you modify the code that test the function that takes the text as a parameter, you can just append it to a file, this is clean, and no run-time performance issues, and you get a new po file every time you run a test.
Using doc is much more complex, and would require a macro, and if you do not want to enter the text twice, you need the macro to do that for you.
#[doc = "TK|TranlationKey|This is the text I want to Translate"]
.text("TranlationKey")
Not bad, but it will also show up in your Documentation, so OrbLingo would have to sanitize them.
You have TK, you search for it, and add it to a database if it is not there, check for an update if it is, and remove it from the doc.
Now you can use it to translate your doc, OrbLingo could take in a blank template, then read in each type of template that matches it, ie index.html, all.html, and the others, and replace it based on id, or class maybe, I have not actually looked at all of them, but for example:
id='structs'
id='functions'
id="search"
id="help"
But that is it, maybe get whoever wrote this to add more id's, like one for every tag that needs a translation. I read in the link in the previous thread, that rust is looking at a similar approach, so these changes might be in the pipe.
Looking for classes like docblock-short
will result in an array.
This is the problem with this approach.
If you have the time to look at what I forked, I added a Wiki and would like to see if you are interested in including it at your site. I would like feedback on it, before actually making a request, basically, it is a how to get started. It is just as easy to create the pages and copy the content, then it is to request a merge if you ask me, but whatever way you want to do it is fine with me.
I have not pushed a project yet, wanted to see if you are interested in it first if so, it would be better just to host it on your GitHub, and make it a real project, the concept is an IDE for OrbTk, I call it OrbIDE, pronounce Orbid-E (Orbidy).
This will run as a Desktop app but it would be great for Redox.
I have a link to a page that tells you about me
I want to see this project improved, by adding Localization, and more widgets, like a Menu, I actually have no idea how to write an IDE in Rust using OrbTk, so this will be fun.
If you make a project in development for OrbLingo, and OrbIDE, we can start work on it, and see how much interest it generates.
If you like the presentation and would like to use it, I am open to suggestions, what is easy for me, is if you open Wiki for me in Development, I can post to it, and you can edit it, and push it when you think it is ready, or I can just do request from my fork.
These ideas are for this project, how you use them is up to you, I am not looking for any credit, I just want to write some software using it.
Update: I am working on a solution that requires the least amount of API changes, and it is at the compiler level:
https://github.com/Light-Wizzard/rust-lingo
Thanks, Flesh
from orbtk.
@Light-Wizzard
Did you quit work on that issue? the given github link seems to be dead ...
from orbtk.
Yes, I went back to using Qt and gave up on Rust till it has its own GUI tools built into it, so I do not have to use 3rd party projects.
My Concept worked by the way, but no one was interested in that Concept, so I deleted it, I think I still have the code, if you are interested, I can make it available.
Flesh
from orbtk.
Related Issues (20)
- [FAQ] Example of using Ron crate for Themes
- [FAQ] Is this project dead? HOT 2
- Simple Example of ListView HOT 2
- Cannot run on Rust 2021 edition HOT 4
- Impossible to select the last tab after the previous last tab was closed HOT 2
- Text looks vague in macos HOT 5
- Is there a widget like TabLayout HOT 1
- About other languages HOT 5
- The Canvas example is missing
- How to solve it that undefined symbols for architecture x86_64 ?
- Hi is there a discord server for this? HOT 6
- Does not compile on Mac M1 Silicon / Arm64 architecture HOT 6
- Compilation failure: "Could not find native static library `SDL2main`" on Gentoo HOT 7
- Undefined symbols for architecture x86_64 HOT 1
- current develop branch breaks on MacOS, showing black window HOT 3
- Is this project still alive, and when can I expect the android and ios support coming out? HOT 1
- TextBlock does not show up HOT 1
- Why did you ditch developing OrbTK ? HOT 3
- orbtk sdl2-sys compiles standalone but not with orbtk
- example consider adding an explicit lifetime bound...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orbtk.