[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.

Snarky

Quote from: Cassiebsg on Mon 17/02/2020 12:51:01
Should be part of AGS pack IMHO.

I think SpeechCenter really should be, as it's an invaluable tool/improvement of AGS. Though I take it that would require it to be open source.

Cassiebsg

Just reporting.

Spellchecker is working perfectly now.  (nod)
Search works better too.
The very very very long label is still a bit overlapping on the last line (the 5th line ... yes it's a very long label), but stretching the browser window a bit more solves the problem.  ;)

As an online editor it's perfect, or very close to it anyway.  (nod)
There are those who believe that life here began out there...

Cassiebsg

Uhm... okay, seems like my info about using UTF-8 was wrong, and it's ANSI instead.  :-[

https://github.com/adventuregamestudio/ags-manual/wiki/Translations

Quote
make sure you save and encode the .trs file to ANSI and NOT in unicode or UTF-8 encoding.

(Sorry for double posting, just wanted to make sure this post is "registered" as new and shows up on the "show unread posts since last visit", as opposed to editing my previous post.)
There are those who believe that life here began out there...

Baguettator

Hi there !

That online tool is nice, but I encounter a problem : I'm french, and the texts in my game use àéèê letters, and they don't display normally in the app. Is it possible to have them displayed as intended ?

Cassiebsg

They should display correctly. I have portuguese (ºçáèéíóá), danish (øåæ) and english keyboard setup and can see all the special characters correctly. So make sure you are using the correct page code.

Are you saying you saying that they don't show up correctly when you're typing the translation, when you save the translation and check it or when you place it in the game?

Otherwise, send me a txt sample of the text showing up wrong, and I'll see if I can figure out how you can fix it.  :)

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

Baguettator

Sorry, maybe I didn't explain clearly. In the online translator, the texts in french (native language of the game) display badly. There are ? symbols (black square with ? inside) in place of éàèê etc...

I think it is not a problem for the translation, but it is a little ugly for the translator, and it could make ununderstanding.

Creamy

Hi Baguettator,
Did you import a font with special characters in your game? See the fonts with "à" on Dafont for instance. The default font doesn't include them. Dans mes jeux ça marche  ;)
 

Baguettator

Hi ! Yes I use a font that works with these characters. (Helvetica, Impact and Crackhouse). In the game it displays normally. It is in the online tool that ? appear.... :)

Cassiebsg

are you using the trs that AGS provides, or some other file? It kind of sounds like you har using the wrong page code to me.

Is it only the displayed text that shows wrong? Can you type regular special characters in the text box? or do these also show wrong?
post your trs file so w can take a look.
There are those who believe that life here began out there...

Creamy

I can see the problem when I open a .trs file with tzachs' online editor.

Speech center translation editor works just fine.
 

Baguettator

It is the letters âéè etc... displayed by the online tool that are displayed with ? in a black square.

I open a trs file from my game in AGS (using ags editor of course)

In the text box, âéè etc... display correctly !

The SpeechCenter tool is good, but it has a bug : when you add a line in the translated text (using ctrl + enter or alt + enter), you save and reload the file, a \[\ is added in place of the line. So instead of :

Code: ags
Mon nom est Andy.

Et vous ?

My name is Andy.

And you ?


It is displayed :

Code: ags
Mon est Andy.

Et vous ?

My name is Andy.\[\And you ?


And after several saves/reloads, it could be (no joke !) :

Code: ags
Mon est Andy.

Et vous ?

My name is Andy.\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\[\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\And you ?


I have mentionned it on the related topic, and someone indicated me your online tool. So I wish to find the best :)

I also find 2 others tool for translation, but the same problem : ? in black square...

https://forum.xentax.com/viewtopic.php3316

https://github.com/Taktloss/AGS_TranslationEditor/releases/tag/v1.1.0.2


Cassiebsg

Uhm, you are not suppose to add any lines to the translated files! One line only per translation.
There are those who believe that life here began out there...

Baguettator

But, how do you translate texts that are written on several lines ? With [ symbols ? In the translator ?

Could you show me an example please ?

Cassiebsg

Here's an example line:

Code: ags

&19 I came as soon as I got the message from Master Jarl [that a bad batch of mushies had been dispatched to your room, sir.
&19 Vim assim que recebi a mensagem do mestre Jarl [que uns mushies estragados fora enviado para o seu quarto, senhor.


The [ represents a break in the text. There's no \ anywhere. I loaded my english trs, added the new translated line and saved it on my hd. I then copy pasted it from notepad to here. (note: I know nothing about SpeechCenter tool, as I've never used it. I'm refering to Tzachs's web app)

EDIT: Also I just tested the trs with foreign characters and they're displaying just fine for me. So again, this is most likely a problem with your computer/OS/browser code page setup.

here's my trs if you want to try it out: http://www.mediafire.com/file/7jkljy9oezj2tmp/ags%25289%2529.trs
There are those who believe that life here began out there...

SpeechCenter

I just checked and indeed when the file is reloaded, the new line is loaded as '[', so later when saved it's '\['.
I'll check how to address it, shouldn't be complex.

@Baguettator I made sure to monitor these forums for anything that comes up with tools I released here, but if I seem to be unresponsive, just give me a nudge.

tzachs

Hi @Baguettator, sorry, just saw this now.
I can't reproduce this error, if you still need help, then I have some questions:
- What OS (and version) are you running on?
- What browser (and version) are you running on?
- Can you supply a sample trs file that shows the problem?
- Do other websites with those characters appear normal in your browser?
- Is it both the text field and label which has this problem, or just one of them?

Sorry for the delay (like SpeechCenter, if I'm unresponsive send me a PM).

Baguettator

Hi @tzachs !

- I am using Windows 10.
- I am using Mozilla Firefox 84.0.2 (64-bit) version
- I don't know how to send you a trs file, but it seems the problem happenned to other people than me (see messages above).
- Yes, with websites these characters are appearing normally
- it is just the non-editable texts that are appearing with ? in black squares, the translation I write with these symbols is normally displayed

tzachs

Thanks @Baguettator, I tried to reproduce on Windows 10 with Firefox 84.0.2 (64-bit) but it still worked fine for me.

The fact that the editable text field works for you but the readonly label doesn't is a heavy hint that the issue is related to how those letters are encoded in your file, so I can't proceed unless you send me your file to debug (or @Creamy or somebody else that can reproduce it sends their file). One way to send the file is to upload it somewhere (like dropbox) and then send me the link. If you're worried about sharing your game text, you can cut out all but 1-2 lines (but check that the problem still persists with the new file).

Thanks.


tzachs

Thanks @Baguettator, I was able to reproduce the problem with that file.

The problem is that the translator assumes the file is encoded in UTF-8, but your file is encoded in Windows-1252.
It seems that AGS uses whatever encoding is set in your machine, which is actually not great, as it means that if you export translation on one computer and import it on another you might have these types of issues as well (or even on the same computer if you switched the encoding). The best thing would probably to always use the same encoding (i.e UTF-8) but doing that now will break current exported translations for people.

Anyway, I tried auto-detecting the encoding of the file but the scripts I found for that were unreliable, so I'm going to add a drop-down for selecting the encoding which should then fix it. I'll update when it's ready.

Crimson Wizard

#40
Quote from: tzachs on Wed 27/01/2021 07:02:16
It seems that AGS uses whatever encoding is set in your machine, which is actually not great, as it means that if you export translation on one computer and import it on another you might have these types of issues as well (or even on the same computer if you switched the encoding). The best thing would probably to always use the same encoding (i.e UTF-8) but doing that now will break current exported translations for people.

Anyway, I tried auto-detecting the encoding of the file but the scripts I found for that were unreliable, so I'm going to add a drop-down for selecting the encoding which should then fix it. I'll update when it's ready.

This is a long known problem, but paradoxically at the same time this is the reason it is possible to easily have extended characters for other languages in AGS, as users only have to set their current locale to certain language and use game font for matching ANSI codepage.

The encoding (codepage) selection is what I was thinking to add to AGS editor as well for some time, as it would make it possible to control result rather than rely on system's locale.
Guess what stopped me is that no one reported problems with this yet (then again, maybe they had problems but did not tell), and simply consideration that it's better to focus on making ags unicode aware.

tzachs

@Baguettator, I uploaded a new version which has a drop-down to select the encoding for your file. If you select "windows-1252" then it should show correctly for your file. What I'm not sure about is whether saving the file will work as expected with AGS, let me know if you're still having issues.

Baguettator

That's perfectly working, many thanks for that !!!

I think your web app is very useful :)

Baguettator

I was asking if the encoding of the translation file should be always UTF-8.

I can select windows 1252 to have a normal display for letters like àéè etc...

But maybe I should select UTF-8 just before saving the file ? I read somewhere that the file should be in UTF-8, but I don't know if it is an obligation.

Anyway, it seems I didn't encounter any problems with that, but I encountered problems with the translation editor of Speech Center, because of the \\\\\\\\ bug.... I have deleted all the \ symbols, but I forgot that they were needed in some cases...

Crimson Wizard

#44
At the moment AGS does not recognize utf-8, so if you save it in utf-8 and it contains any extended unicode characters then they wont look correct in the game (they may be printed like two or more random characters, or text will be just cut in the middle).

If you save as utf-8 with BOM, then it may wont be able to parse translation file at all, due to unrecognized header.

Baguettator

Thanks Crimson Wizard, so I don't know what I should do. Which format should I use ?

It seems that AGS creates translation files in UTF-8, as @tzachs said before about my file. Or I don't understand anything :p

Crimson Wizard

Quote from: Baguettator on Thu 04/03/2021 09:23:08
Thanks Crimson Wizard, so I don't know what I should do. Which format should I use ?

It seems that AGS creates translation files in UTF-8, as @tzachs said before about my file. Or I don't understand anything :p

No tzachs said different thing, he said that his program expected UTF-8 before, which was a mistake. Was not Windows-1252 already working for you, or there are other problems remaining?

Baguettator

Ah ok, I understand. Windows 1252 works very well for me, so I can save the translation file in Windows 1252 ?

Baguettator

OK, I have tested a few things, and I have to report a bug.

I restart my translation file from a new one. So I translated the first lines with windows 1252 format. I compile and launch the game.

In game, original texts that were using special characters like àéè etc... weren't translated. Whereas I have translated them in the .trs file.

I tried a new translation file, I openned it with notepad program, translated the same first lines, saved it and launched the game. The texts displayed perfectly, event with such characters as àéè etc...

So I think there is a problem with AGS that don't recognize some format. But windows 1252 probably doesn't work.

I have to say that if I choose windows 1252 format, in tzachs's application, I can see the special characters àéè correctly. But when I save the file, the translation is not working in game.

For the moment, I will go on with notepad until a solution is found. But anyone knows what happens ? tzachs's browser app is very useful, but unfortunately it doesn't work again :(

EDIT : sorry that I insist on this thread, but it took me a long time of research to solve a problem linked with the translation, I thought it was my code but in fact it was the format I presume...

Crimson Wizard

#49
Quote from: Baguettator on Thu 04/03/2021 10:27:34
So I think there is a problem with AGS that don't recognize some format. But windows 1252 probably doesn't work.

To clarify, Windows 1252 is not a format, it's codepage. Format is ANSI. AGS uses ANSI (1 byte per character).

How is your file saved when you work in notepad? Also, what is your system locale for non-unicode programs, is it actually windows-1252 or something else? If you don't know for sure this is how you may find out: https://www.java.com/en/download/help/locale.html

It's important that text codepage and font match each other. Everything else is only a matter of convenience.

But, I never used tzach's application or seen its code, so can only speak about how AGS works. Maybe there's still some problem in how tzach's program saves it.

Baguettator

Thanks Crimson for the help.

Well, my system locale for non-unicode programs is called "Français (France)", so I don't know if it is "windows 1252" ?

When I use notepad, I simply open the trs file with notepad, add the translations and then save it. And it works perfect. I think tzachs is the man of the situation, since the problem seems to come from his great app ! :)

Cassiebsg

If you open notepad, and then do "Save as..." you can see the encoding it's using: ANSI.

So, when you save from Tzachs's app, save it as ANSI.
There are those who believe that life here began out there...

tzachs

Hey, so I think I misunderstood the web api for saving blobs, I gave it the charset of windows-1252 and assumed it's going to encode it with that charset but it seems as though it still saves it as utf-8. There doesn't seem to be a simple built in way in javascript to convert encoding from utf-8, just the other way around.

Baguettator, a workaround can be just to take the output file and then use a different tool to convert the encoding. I found this website which seemed to work fine when I tested it with an output file.
Can you try to take the file you get from my website and feed it to that website and see if it works for you? i.e copy/paste the text to that textbox, select windows-1252, click "Calculate" and then the "text.txt" link? Let me know if that works for you.

Quote from: Crimson Wizard on Thu 04/03/2021 10:35:41
To clarify, Windows 1252 is not a format, it's codepage. Format is ANSI.
Sorry, can you expand on this? It confused me, looking here it seems Ansi and Windows-1252 is pretty much the same thing?

Quote from: Crimson Wizard on Thu 04/03/2021 10:35:41
But, I never used tzach's application or seen its code
If you're interested, code is here.

Crimson Wizard

#53
Quote from: tzachs on Sat 06/03/2021 05:36:35
Quote from: Crimson Wizard on Thu 04/03/2021 10:35:41
To clarify, Windows 1252 is not a format, it's codepage. Format is ANSI.
Sorry, can you expand on this? It confused me, looking here it seems Ansi and Windows-1252 is pretty much the same thing?

I may be not 100% correct in using this term either, but I used to think ANSI is an umbrella term for 1-byte windows encodings, Windows-1252 is one of the several codepages that may be used to encode.
Cyrillic encoding is Windows-1251 for example, and it uses same 1-byte format (with numbers 0-255).

In practice, text editors that save files "as ANSI" usually save in default locale from system settings (they don't forcefully reencode in Windows-1252, as that would quickly become a headache for users outside of the western europe/usa).

Cassiebsg

Hi.

Just a note about using the editor.
The other day I was happily translating when I decided to "undo". For some odd reason, I can't explain, I hit the "back" button on the browser.  8-0 And thought "oh no! Now I've lost everything I've done so far!"  :~( I hit the "forward" and was happy to see the text was still there!  :-D So I translated a few more lines, and then being tired, I decided to save and go to bed... only to find to my horror that the save button didn't work!  8-0  :~( I tried saving the page, in the hopes that I could grab the text from the html page later on, but no dice either.

Probably nothing you can do about it, but just thought I would mention it. So anyone using this editor will save often and don't continue translating after such a fail.  (roll) I missed 50 lines.

I'm not sure having the encoding as UTF-8 is a good thing, but since CW has now made UTF-8 sorta working, then it probably won't matter anymore.  :)
There are those who believe that life here began out there...

Crimson Wizard

Quote from: Cassiebsg on Sat 26/06/2021 14:26:39
I'm not sure having the encoding as UTF-8 is a good thing, but since CW has now made UTF-8 sorta working, then it probably won't matter anymore.  :)

By the way, I will use this opportunity to say that will be very interested to have more testers for utf-8 translations. Right now only LauraHunt agreed to try it out.
https://www.adventuregamestudio.co.uk/forums/index.php?topic=59240.0

And yes, ideally after this feature is added there will be no reason to NOT use UTF-8 in translation files anymore.

SMF spam blocked by CleanTalk