I
I
Ilya Kovalevsky2014-01-11 23:01:54
JavaScript
Ilya Kovalevsky, 2014-01-11 23:01:54

Is it worth continuing to work on the framework?

Hello.
Since I'm going to be working with a wide, multilingual Rich Internet Application one of these days, I started googling various front-end translation frameworks. Since none of them really impressed me, I decided to file my scooter.
Borrowing the mechanism of Qt Linguist, I decided to implement this business in JavaScript. So far, the functionality is very, very roughly meager (you need a tool for tracking template strings, a normal template engine, high-quality work with the DOM). But now you can do something like:

Train.dictionary("ru");
Train.tr("Great progress, %1").arg(nickname); // "Отлично работаешь, Олег!"

Is it worth it to bring it to mind? Already posted on tucnak.github.io/train under the MIT license, so everything is free.
Thank you!

Answer the question

In order to leave comments, you need to log in

7 answer(s)
Y
Yuri Shikanov, 2014-01-11
@dizballanze

Why translate on the front-end?

S
Stanislav Lomadurov, 2014-01-11
@lomadurov

And why not, especially with the widespread use of SPA, the value of this library is growing before our eyes.

K
Konstantin Kitmanov, 2014-01-12
@k12th

Have you seen polyglot.js ?

L
lookid, 2014-01-12
@lookid

It's just that javascript isn't particularly interesting. It would be possible to write another tool for those who do not know javascript, for example, for translators. They write (compile) the translation. Toolza mapit and gives something like:

Train.dictionary("ru", {
    "roses_are_beautiful_flowers" : "Розы красивые цветы"
});

Train.dictionary("de", {
    "roses_are_beautiful_flowers" : "Rosen sind schöne Blumen"
});

Then the server does:
if ('lang' == 'eng')
    trans = '/trans/english.jstmp';
elseif ('lang' == 'rus')
    trans = '/trans/russian.jstmp';

and finally:
<script type="javascript" href="<? echo trans ?>" />

S
Serj-One, 2015-02-15
@swipeshot

Apparently, you are not familiar with PL at all, but you are guided by the frontend, so JS (although without looking at the frontend, I would advise python as the first language). If you don’t know at least the basics of js, don’t start learning jQ in any case, nothing good will come of it.
Then you can plunge into something server-side, but by that time you yourself will know what you need, and it’s not a fact that it will be php.
So as not to produce unnecessary questions, here's a tutorial right away - David Flanagan - JavaScript. Detailed guide...

T
Tosch, 2015-02-15
@Tosch

I wouldn't say so. I am also a beginner and just read the first books on html and CSS, took courses on all known resources as well as the author, and I have a lot of questions of a similar nature.) I heard about habr back in 2010 but didn’t bother to register ... It’s good that this the day has come and I'm with you) There are so many interesting things here - I'm shocked, in fact, I decided to learn JS as the first commenter advised, the word Python scares me)

W
WTERH, 2015-02-15
@Expany

MySql, Perl, C, C++, C#, Assembler Probably so, you can, of course, look towards esoteric languages ​​to break your head, but this is already to your taste.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question