[Feature suggestion] (DONE) Translation Editor (Browser tool)

Started by Cassiebsg, Sat 11/01/2020 00:39:32

Previous topic - Next topic

Cassiebsg

Okay, I'll start by saying that if I had the skills to do this, I would do it myself.
So I'm just putting the idea here, in case anyone with the skills, time and will, can do it.

Problem: As anyone who ever have dealt with translations knows, it's very easy to break the translation file. And fixing it again takes forever. So I thought that if we could eliminate the possibility of messing the original lines, then it would make both the translator and the dev really happy.  (nod)

Suggestion: Create an editor for trs files. External to AGS. Maybe call it AGSTRanslationEditor.exe (or AGSTRSEditor.exe). But it should be an exe that does not need AGSEditor or any AGS stuff. So in reallity it's just a program that can load and save text files with the extension trs.

Features:
- Load trs file
- Save trs file
- Spellcheck (optional if too complicated)
- Text display for original line - not editable!
- Text box to enter translated line.
- Button/Arrows for next and previous line.
- Eventually box to jump to line number. (like you have translated 200 out of 500 lines, just jump to line 200 and continue)
- Box/help displaying the trs warning about characters and such (optional)

That's about it. Basically just a text editor oriented specifically to handle a trs file.

Distribution: Packed with AGS Editor and as Standalone.
There are those who believe that life here began out there...

tzachs

I made a small web app that I think meets most of your requirements: https://tzachshabtay.github.io/ags-trs-editor/

I never worked with trs files myself, and I guessed at the format, so if it doesn't work for you, send me your file so I can fix it.

Quote
- Box/help displaying the trs warning about characters and such (optional)
I didn't know what that means so I didn't do it.

Cassiebsg

A web app sounds like a good idea, unfortunately I don't know how to use it.  :-[
When I follow you link all I get is a blue top bar with the name of the app, a load icon and the link to the source.
Rest of the page is just blank.  ???

Clicking the Load opens windows explorer and asks me to upload a file? I tried choosing a trs file but all I got was an empty page.
As for the source I woudn't even know where to begin to use it.

The text warning is the first few lines of any trs file.
Quote
// AGS TRANSLATION SOURCE FILE
// Format is alternating lines with original game text and replacement
// text. If you don't want to translate a line, just leave the following
// line blank. Lines starting with '//' are comments - DO NOT translate
// them. Special characters such as [ and %%s symbolise things within the
// game, so should be left in an appropriate place in the message.
//
// ** Translation settings are below
// ** Leave them as "DEFAULT" to use the game settings
// The normal font to use - DEFAULT or font number
//#NormalFont=DEFAULT
// The speech font to use - DEFAULT or font number
//#SpeechFont=DEFAULT
// Text direction - DEFAULT, LEFT or RIGHT
//#TextDirection=DEFAULT
// 
// ** REMEMBER, WRITE YOUR TRANSLATION IN THE EMPTY LINES, DO
// ** NOT CHANGE THE EXISTING TEXT.

Uhm, after posting this I just noticed something which I always assumed wasn't changeable. So going to do a few tests on the trs file.

As for the format for trs file is just a text in UTF-8 encoding.

If you need some trs to test (these are for the Indiana Jones and the relic of the Viking demo):

Original trs: https://www.mediafire.com/file/3vg9hz9uhkm5kha/New.trs/file

Trs with Italian translation: https://www.mediafire.com/file/5q05tlso7y2ji3b/ITA.trs/file

There are those who believe that life here began out there...

tzachs

Thanks for the sample files, it should work now if you want to try again.

(Yes, you should click the load icon and select a trs file).

Cassiebsg

Thanks, I can nos see "Please Load trs file".
But when I do load it, all I get is still an empty page. And I have set all scripts on.  :-\

Maybe it just doesn't work with my browser? Firefox 59.0.3 (64 Bits)
There are those who believe that life here began out there...

Snarky

Seems to work OK for me (Firefox 72.0.1). Click on the upload file cloud icon, select Cassie's trs, and it shows a list of all the original lines with the ability to enter translations.

Cassiebsg

I decide to post it on the cog7 (Indiana Jones and the Seven Cities of Gold) forum to get feedback from those translating the demo.

Here's one comment (http://binarylegends.net/forum/index.php/topic,981.msg8509.html#msg8509)
Quote
The editor seems to work but I have one big feature request: I cannot search for strings in the whole file. I assume the web server streams the content, so searching is limited to the part which currently is transmitted. And line numbering would be great.
There are those who believe that life here began out there...

tzachs

Quote from: Cassiebsg on Sat 18/01/2020 10:57:53
But when I do load it, all I get is still an empty page.
Hmm, can you try opening the console and see if there are any errors there?
https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Opening_the_Web_Console

Quote
The editor seems to work but I have one big feature request: I cannot search for strings in the whole file. I assume the web server streams the content, so searching is limited to the part which currently is transmitted. And line numbering would be great.
I added search and line numbering (there's currently a known issue though that if you search it screws up the navigation buttons, I'll fix that hopefully tomorrow).
Just as FYI: it's not that the web server is streaming the content, the client has all of the information, it just doesn't render it because that would be too slow, so the browser can't find it on its own.

Cassiebsg

This error seems to be reported: TypeError: this.props.from.trimStart is not a function (23 errors of this kind)
The CSS pane also throws a bunch of errors:
- Unknown property ‘-moz-osx-font-smoothing'. Declaration dropped.
- Expected media feature name but found ‘prefers-reduced-motion'.
- Unknown property ‘flip'.  Declaration dropped.
- Expected media feature name but found ‘hover'.
- Error in parsing value for ‘animation'.  Declaration dropped.
- Error in parsing value for ‘animation-name'.  Declaration dropped.
- Unknown pseudo-class or pseudo-element ‘-webkit-input-placeholder'.  Ruleset ignored due to bad selector.
- Unknown pseudo-class or pseudo-element ‘-ms-input-placeholder'.  Ruleset ignored due to bad selector.
(others similar to the above)

But since it works for Snarky, it just means it doesn't like my old browser. Not your fault.  ;)
There are those who believe that life here began out there...

tzachs

Quote
This error seems to be reported: TypeError: this.props.from.trimStart is not a function (23 errors of this kind)
Ah, seems trimStart was only introduced in Firefox 61. I fixed it (and I downloaded firefox 59 to see that it works on it after the fix).
I also fixed the other issue I mentioned before.

Cassiebsg

Oh, cool! It works now!  :-D
Sorry that I use an old browser... but it's like every time Firefox updates the browser they ruin something I love in it and take control from me to their own automatic crap. And I don't like relinquishing certain things.

Edit:
I do feel this text should be added somewhere:
- If you don't want to translate a line, just leave the following line blank.
- Lines starting with '//' are comments - DO NOT translate them.
- Special characters such as [ and %%s symbolise things within the game, so should be left in an appropriate place in the message.

Maybe they could be added  in the empty space after the search box? Or maybe under the buttons in the blue frame? Or a frame for it self at the top?

But also, very cool that it runs on the browser, since I have spell check on my browser, that solves that problem (at least for me, no idea how spell checking works in other browsers).  :-D

So, from my original request, the only thing missing is the ability to jump to a line, by typing 808 and jumping to line 808.
Thanks again for doing it, I can see a lot of devs and translators being happy with the tool and saving them countless hours of headache trying to find that character that ruined the formating by accident.  (nod)

Edit2:
I tried and saved the file, to compile it. It saves as ags.trs, maybe it could ask to enter file name? Not a big deal though. it's easy to change the file name afterwards.
Also noted it adds an empty line at the top of the file. I tested compiling it with the empty line and the translation seems to work fine with it. So not a big deal, if it's too much work to remove it.

Again, super work! Maybe ready to be posted for others in here to know and start using it?  (not sure how many read the Engine Development forum).
There are those who believe that life here began out there...

tzachs

Quote from: Cassiebsg on Tue 21/01/2020 11:51:26
Sorry that I use an old browser... but it's like every time Firefox updates the browser they ruin something I love in it and take control from me to their own automatic crap. And I don't like relinquishing certain things.
I figured it was something like that. But actually it's not that old, March 2018 is still reasonable, I feel.

Quote from: Cassiebsg on Tue 21/01/2020 11:51:26
I do feel this text should be added somewhere:
- If you don't want to translate a line, just leave the following line blank.
- Lines starting with '//' are comments - DO NOT translate them.
- Special characters such as [ and %%s symbolise things within the game, so should be left in an appropriate place in the message.
Ok, added the text, with the exception of the comments line. I think it's irrelevant in the context of the editor, the comments will not be displayed so you won't be able to edit them either way.

Quote from: Cassiebsg on Tue 21/01/2020 11:51:26
But also, very cool that it runs on the browser, since I have spell check on my browser, that solves that problem (at least for me, no idea how spell checking works in other browsers).  :-D
Yes, that's one of the reasons I figured web would be a good fit (also undo/redo without effort). The spellcheck kind-of-works on chrome, but it's a hit or miss.
Also not sure how the spellcheck works for other languages which are not in your browser's preference. It might be possible to improve the experience (maybe there could be a language selector that sets the spellcheck for that language or something like that - I don't know if that will help).

Quote from: Cassiebsg on Tue 21/01/2020 11:51:26
So, from my original request, the only thing missing is the ability to jump to a line, by typing 808 and jumping to line 808.
Added.

Quote from: Cassiebsg on Tue 21/01/2020 11:51:26
Thanks again for doing it, I can see a lot of devs and translators being happy with the tool and saving them countless hours of headache trying to find that character that ruined the formating by accident.  (nod)
:)


Quote from: Cassiebsg on Tue 21/01/2020 11:51:26
I tried and saved the file, to compile it. It saves as ags.trs, maybe it could ask to enter file name? Not a big deal though. it's easy to change the file name afterwards.
This depends on the browser. Chrome does ask you to enter a filename.

Quote from: Cassiebsg on Tue 21/01/2020 11:51:26
Also noted it adds an empty line at the top of the file. I tested compiling it with the empty line and the translation seems to work fine with it. So not a big deal, if it's too much work to remove it.
Fixed.

Quote from: Cassiebsg on Tue 21/01/2020 11:51:26
Again, super work! Maybe ready to be posted for others in here to know and start using it?  (not sure how many read the Engine Development forum).
Thanks! And feel free to spread the news!

eri0o

1. This is super cool!

2. I don't know in the forums where to post tools (since they aren't modules or plug-ins), but am curious about it too!

Cassiebsg

Uhm, funny. I was pretty sure I tested the line jumping function when you posted it was done.
But I'm currently using it to do a translation and just noticed that when I click the jump button nothing happens.  ???

Only "error" I get in the console is in CSS:
QuoteExpected media feature name but found ‘hover’.

This happens when opening the pop-up window to enter the line number. Clicking the buttons produces no extra information on the console.

If it's just cause I have an old browser, don't worry about it, I can scroll down.  ;)

Edit:
Might as well answer this one, at least for FF.
QuoteAlso not sure how the spellcheck works for other languages which are not in your browser's preference. It might be possible to improve the experience (maybe there could be a language selector that sets the spellcheck for that language or something like that - I don't know if that will help).

With FF, or the addon I have installed, I can choose which language/dictionary to use. So first I just have to check that I want the spell-checker on, on that particular text box. Then I can right click again, and select which language/dictionary to use. I have European Portuguese (before orographic agreement), English UK, English US and Danish. These are the languages I write and need, but can install as many as I want.  ;) It works so well, that I often just open any website with a text box, and then type what I want in it and copy/paste it to email.  (roll)

EDIT: I found a BUG!
If I hit ENTER the editor will add a new line. We do not want the user to be able to add new lines. Is it possible to make it detect the enter and just make it jump to the next line to edit? Like the TAB does?

There's another one, but I'm not sure if it's possible to fix or how. If you have a very long line (because it's a long text that is being displayed by a label), the original will "bleed" into the line to type in. Making it hard or impossible to see what one is typing. (Maybe remove line warp and just let the line be as long as needed?)
There are those who believe that life here began out there...

tzachs

Quote from: Cassiebsg on Wed 05/02/2020 12:15:29
Uhm, funny. I was pretty sure I tested the line jumping function when you posted it was done.
But I'm currently using it to do a translation and just noticed that when I click the jump button nothing happens.  ???
I can't reproduce this on latest firefox. I tried to download your version but it crashes on my machine so I don't have a solution for this.

Quote from: Cassiebsg on Wed 05/02/2020 12:15:29
EDIT: I found a BUG!
If I hit ENTER the editor will add a new line. We do not want the user to be able to add new lines. Is it possible to make it detect the enter and just make it jump to the next line to edit? Like the TAB does?
Oh, I actually went into trouble to support multiline inputs.. Ok, fixed (enter does nothing now- it's technically possible to make it behave like a tab, but too much work I think for supporting this compared to the benefits).

Quote from: Cassiebsg on Wed 05/02/2020 12:15:29
There's another one, but I'm not sure if it's possible to fix or how. If you have a very long line (because it's a long text that is being displayed by a label), the original will "bleed" into the line to type in. Making it hard or impossible to see what one is typing. (Maybe remove line warp and just let the line be as long as needed?)
So, I'm using material-ui TextField's label for this, and they don't want to support long labels by design (see here: https://github.com/mui-org/material-ui/issues/12255), and they don't support not wrapping either. So I changed it to use "helperText" instead of label if the text is long, which means the text will appear in the bottom instead the top but it will not break the layout and you'll be able to see it all. It's not perfect, though, I just picked a random number (200 characters) which looked good on my machine, but your results might vary (it will definitely still look wrong if you use a phone in portrait, for example).

Cassiebsg

Thanks, I'll report later once I'm back at having time to translate some more lines.
I don't use a phone, don't even have a smart phone even if I wanted to use use it, but my browser usually only covers half the screen, but I can always stretch it a bit more if needed.  ;)

If the helperText solves the problem, maybe it would be worth using it for all lines? Two reasons I can see this as an advantage is: consistency (the original line is always in the same place) and those that want to use the phone (maybe they've got some time to kill somewhere, and their phone is right there) can use it without trouble. But I don't know if there's an advantage over the other.  (roll)

Seems kind of weird that they don't want to support long labels though. Why limit a tool this way? Being pig headed?  ???

EDIT: Weird... I've sat to do a few lines, and now the spellchecker isn't turned on. I have to turn it one for every single line now!  8-0 This wasn't happening before, once I turned it on it would be on for all lines on the page. I'm not sure why this is happening now. Did disabling the Enter key did this? Or was it the helperText? Or something else?

As for the jump feature, I managed to make it jump, and then it stopped working again. But like I said, I can just scroll up/down as needed. EDIT3: Uhm... if I add a space to the search box, then the jump works!  (wtf)

Also the search function seems to find only the first line that word is used.  ??? (EDIT2: Oh, it's case sensitive! Not sure this is the best choice to use in a search box though.  :-\ ) I'm pretty sure this was working before... unless I only used it to find a single word that was used only once in the text. But I can't use it to find the line and jump to that line either. Have to delete the text from the search box and then I'm back at the top on line 1 (even if the found line was 148 and I was on line 1735 when I performed the search).
There are those who believe that life here began out there...

tzachs

Quote from: Cassiebsg on Sun 09/02/2020 11:27:56
If the helperText solves the problem, maybe it would be worth using it for all lines? Two reasons I can see this as an advantage is: consistency (the original line is always in the same place) and those that want to use the phone (maybe they've got some time to kill somewhere, and their phone is right there) can use it without trouble. But I don't know if there's an advantage over the other.  (roll)
I considered it, but it doesn't look as nice (i.e you'll lose the text compaction when there's no translation for the line and the nice animation that goes with writing text in the field). I think that the long labels that break the layout are very rare so that breaking the consistency, while not ideal, is not a big deal.

Quote from: Cassiebsg on Sun 09/02/2020 11:27:56
Seems kind of weird that they don't want to support long labels though. Why limit a tool this way? Being pig headed?  ???
I think it's a "for the greater good" decision. The use-case for such long labels is very rare, and fixing it increases the complexity of the code in a way that future features will be harder to develop and it risks creating more bugs for the majority of the users.

Quote from: Cassiebsg on Sun 09/02/2020 11:27:56
EDIT: Weird... I've sat to do a few lines, and now the spellchecker isn't turned on. I have to turn it one for every single line now!  8-0 This wasn't happening before, once I turned it on it would be on for all lines on the page. I'm not sure why this is happening now. Did disabling the Enter key did this? Or was it the helperText? Or something else?
Definitely not the helperText, but switching from multiline input to single line input, unlikely, but maybe? Browsers might have a default of whether they should spell check or not, and it's on for multiline and off for single line? A very wild guess on my part. Anyway, I tried to explicitly enable spellchecking on the controls, let me know if it improves the situation.

Quote from: Cassiebsg on Sun 09/02/2020 11:27:56
As for the jump feature, I managed to make it jump, and then it stopped working again. But like I said, I can just scroll up/down as needed. EDIT3: Uhm... if I add a space to the search box, then the jump works!  (wtf)
Oh! I had a bug when clearing the search (I forgot to clear the mapping between the real line index and the line index that passed the search). So after clearing the search jumping lines might have been broken. I fixed the bug, hopefully that was what you were experiencing.

Quote from: Cassiebsg on Sun 09/02/2020 11:27:56
Also the search function seems to find only the first line that word is used.  ??? (EDIT2: Oh, it's case sensitive! Not sure this is the best choice to use in a search box though.  :-\ )
Changed the search bar to be not case sensitive.

Quote from: Cassiebsg on Sun 09/02/2020 11:27:56
Have to delete the text from the search box and then I'm back at the top on line 1 (even if the found line was 148 and I was on line 1735 when I performed the search).
I changed it so the editor will try to keep you in the general whereabouts of where you were when changing the search (doing it accurately is very tricky, but it should be somewhere in the ballpark).

SpeechCenter

Note that the I created a while back a tool to edit translation files (https://www.adventuregamestudio.co.uk/forums/index.php?topic=46417)
It is separate from the AGS editor. It's a desktop app and not web, so this one might be more modern/have different features. Still, I thought you might find it useful, my intent when writing that app was to keep it as simple and lightweight as possible.

Not sure if there's anything we can collaborate here, or just have different tools, I'm open to any option :)

The SpeechCenter plugin can also edit the translations, but this is from within the AGS editor.

Cassiebsg

Oh, I wasn't aware of this one.  8-0 Why wasn't I aware of it?  ??? Should be part of AGS pack IMHO.
And I see that both tzachs and Monsieur OUXX knew about it...   (roll)

I think it's very hard to find what tools are available and what is not, specially if you're knew.  :-\
There are those who believe that life here began out there...

Crimson Wizard

Quote from: Cassiebsg on Mon 17/02/2020 12:51:01
I think it's very hard to find what tools are available and what is not, specially if you're knew.  :-\

I said this in another thread, but imo there has to be a module/tool/plugin database similar to the games db, where one can search by category.

SMF spam blocked by CleanTalk