Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Avventura nel CAT tool

A topic by Niccolò Romero-Passerin created Dec 08, 2023 Views: 688 Replies: 12
Viewing posts 1 to 6
(1 edit) (+2)

Hello !

For those who are having trouble working directly into the javascript file, I recommend trying to use a CAT Tool.
A CAT is not just a wondeful brand of tractor or the translator favourite companion, but also a software that helps the translator keeping track of their translation. The Memory helps you by telling you how you previously translated similar sentences, and the UI put source and target clearly side by side.


In our Javascript case, it can also help because you can program it to give you only the text that needs translating :)
There are plenty plenty of options out there, and I imagine you can make .js file work with pretty much any of them.
But I use these one, so here is how to add a .js file and have it properly analyzed.

I'll talk about MemoQ (free trial) and Trados Studio (no free trial). The best solution is OmegaT (free and open source) but I could not make it work for the time being.
If you know how to make OmegaT accept .js file please share it below. And If you're familiar with any other software don't hesitate to share as well !

(2 edits) (+1)

MEMO Q
MemoQ is a paying software but it has a 30 day free trial which (conveniently) covers the entire locJAM period ;)
You can download the translator version directly off their website. and once installed you can request a free trial when it asks you for your activation code.

Then you can get down to it:

- Create a new Project without template, name it and set the source and target language.

- Import the "I8n" file (use the "All files" option to find it)

- Go to filters & configuration and search for the "Regex text filter"/defaul

- Click on "Change filter & configuration"

- Go to "Import/Exclude"tab and check the option called:
"Rules define imported content (nothing elese is imported)"

- Then add this rule:

 Before: `     After: `
 Rule: .+

Click "Add" and you can check to the Preview tab to see if it worked.

-Click OK until you can go to the next step Translation Memory. Create one with the "Create/use new". It should autofill correctly.

-Then click finish. It will process the files and drop you in the project menu. Double click the file:.

- And tadaa ! Your ready to translate

When you're done you can use Export to create the translated file.

(1 edit) (+2)

TRADOS STUDIO

Similarly to MemoQ, Trados is a professional paying software. But it does not have a free trial period as far as I know, so I'll be a bit more concise.

To force Tardos to accept .js file:

- Go to the burger menu, then Option

- In File type click on "New" and select "Regular Expression Delimited Text"

- Configure the new file type witht he mane you want, and in the "file dialog wildcard expression" section write *.js

- Once the file type is created, go to "Document structure" and create a new rule:

opening pattern: `
closing pattern: `

- Try the preview to check if it work with your file. Then save and create your project as you like :)

Thank you Niccolò, that's amazing 💗

Thank you very much for the tutorial, Niccolò! I am following Trados tutorial and I already created the required file type but I can't seem to find the "Document structure".

(1 edit)

Nevermind, found it by expanding the newly created file type from the list.

Sorry I initially wanted to add picture to make it more clear, but for some reason Itch would not let me....

Oh god, it worked, thanks so much! This definitely helps a lot.

(1 edit) (+1)

Here are some xliff files! You can import these directly into your CAT tool if you are not yet comfortable with filtering java language. Please note that you will still have to manually manage some non-translatable content yourself, but it should be less frightening than the actual .js file ;)

These are plain xliffs made thanks to the Okapi framework, you should be able to open them in any and every CAT tool there is. Open source for the win!

You can find them here: https://localicows.itch.io/public-xliffs-locjam-2023. Please don't hesitate to tell me if you think I should post the files elsewhere.

(+2)

OMEGAT

Contrary to both memoQ and Trados, OmegaT is a completely free and open-source program. This makes it an excellent choice for people who do not need to use CAT tools everyday and do not mind having a little less options. OmegaT does feel "old" compared to proprietary programs, but it's still an excellent and powerful tool. The main difference is that you have the source and target text under each other instead of next to each other. 

OmegaT does not know how to handle .js files natively, but there again, you can simply "tell" the software what to do with it. 

Step 1 : Open OmegaT and create your project: first, choose an empty folder to hold the project's subfolder (source, target, TMs, etc.). Set the source and target languages, then select “Local File Filters...”


Step 2: From there, find the “Key=Value text” filter. No need to change the other settings. Simply select that filter and click “Edit...”


Step 3: In the list that opens, click on “Add…” and change the "Source filename pattern" from “ *.* ” to “ *.js ” so that this filter now applies to every file with the Java extension. No need to change anything else from the default.


Step 4: Click on OK several times to go back top your project creation wizard. Then you can simply add the file to the project's source folder, it should now be detected by the software as a translatable file. You can then translate the file in the editor.

When you are done translating, click "Create translated files" in the Project menu, and your translation will appear in the project's target subfolder. 

(+1)

I don't mind OmegaT's UI -- it's easier to understand for me than Trados or Passolo, and it runs natively on Linux. It's even used by some translators professionally, and I aim to do that as well. But that's not what I actually wanted to say, SO:

Thank you  for that tip with the file filter! That already helped a lot. However, I'm not sure if the keys are supposed to still be displayed?  So, the software doesn't extract the inline texts but instead displays everything.

Hello! I kinda agree with you about OmegaT. I'm probably a bit too used to MemoQ  to love OmegaT as much as it deserves haha. Lokalize and Poedit are great options for Linux too!

Regarding your question, this method only allows OmegaT to handle the file, it does not extract the to-be-translated strings from the rest of the text. Our team has been struggling with that part since day one. Currently, the best option that Niccolò (above) found with OmegaT is to tweak the segmentation rule. 

To do so, go to your project Properties and click on Local segmentation rules. From there, click Add to add a rule. Choose a name for it (for instance "js ` strings" in the example below), and set the "language pattern" option to " .* ". 

In the second box of the window, type a ` symbol as "Pattern before", and add another line so that you can also type it as "Pattern after". Tick both lines as "break/exception".  This will add line breaks before and after each ` sign. It does not exactly extract the text, but isolate it from the rest so that it is slightly easier to read and translate in the editor. This is far from ideal but it is the only way that we've found for now. Please do let me know if you or anyone else finds a better method! 

 Don't forget to save your new settings and to reload the files in the project. 


One other process we found is to convert and extract the strings from the .js file into an xliff with Rainbow from the Okapi Framework. This way, only the translatable strings are imported into the xliff and appear in the editor. Once the translation is done, you can convert your xliff back to a translated .js file. In my opinion, it is the most efficient way to go, but it requires more tinkering than simply dealing with CAT tools filters. I'll be glad to write a tutorial about that too if needed, though.

Hope this answers your question! Please don't hesitate to contact me should you need anything else.

(+1)

Hello Alinamethyst,

Yes we still have not found exactly how to have only the to-translate text appear.
However, using custom segmentation rules you can have it separate from the code ('avant' is before, 'après' after) :Image

It's not perfect but at least you can deal with the text separate from the code :)