Hello it's me again with another question
None of the CAT tools I work with are able to read .lua files so I wanted to know if anyone else is going to translate using a CAT tool and if it's possible to convert the loc file into some format that can be read by these tools. I know .txt works but I'm wondering if it's possible to isolate the strings without losing formatting.
I hope this makes sense. Happy translating everyone!
The instructions above were a good hint/start, but didn’t work instantly. After fiddling a bit around I had it set up rather quickly in memoQ.
You can download the exported filter rule for memoQ from our server. Just unzip the file and import it in the Resource Manager thingy. (If you don’t trust random files from strangers, just open it with a text editor, it’s really just a text file.)
This setup will also keep the comments out of your translation as they felt a bit too generic to really help IMO.Note this isn’t a filter chain, so you’ll still have to escape both linebreaks as\n
and ANSI double quotes as\"
to avoid script errors.
Alternative for those with just Office and similar programs:
^(t\[\d+]\s+=)\s+(".*")\s+(--)
and replace it with$1\t$2\t$3
.--
(i.e. all the comment lines).Note this might screw with quotes in your text, so you should double-check them in a regular text editor once you’re done.
Hi! Could you please point out where I went wrong?
The text editor didn't find any matches for the pattern ^(t[\d+]\s+=\s+")(.*)("\s+--), so I changed it to ^(t.[\d]+.\s+=\s+")(.*)("\s+--) which seemed to work (I by no means know what I'm doing when it comes to regex, so the issue probably lies here). I replaced the matches with $1\t$2\t$3 and converted the file to TSV.
However, when I opened it as a TSV in Excel, all the lines were in one long row (see the screenshot).
How do I fix this? Is there another regex pattern I could try?
Updated the original post. The old regular expression didn’t work since the editor ate a\
at the start and\[t]
means something different than[t]
.
You can do this replacement in two steps without regular expressions:
= "
with =<tab>"
." --"
with"<tab>--"
.Then remove the lines at the start just like I mentioned above and it should work. (Does so for me in Excel.)
And since I forgot adding it above, posting this standalone for visibility for those wanting to set up their filters manually:
Regex pattern before translatable text (i.e. start):^t\[\d+] = "
Regex pattern after translatable text (i.e. end; mind the number of whitespaces!):" --
Regex pattern for translatable text (might be needed, e.g. in memoQ):.+
Thanks a lot for sharing this. In Trados I also managed to include the comments as non-translatable tags this way:
- Change the closing pattern of the file type to: $
- In "Inline tags" > "Add rule..."
Rule type: Placeholder
with rule regex: " --.*}
In Advanced... choose behavior as "Include".
(Note: it is the first time I try using inline tags generated by me, so please take this with a grain of salt! I am still in the middle of the translation, and while I tested exporting it and it seems to work fine, it might still fail somehow.)
I just turned it into a txt. file then opened it normally in Studio. Without doing anything more the "explanation" strings actually help in the file. Then you can either copy over the contents back into the original file or rename your translation file into a lua file. On the other hand, my game now shows a black screen, so maybe I'm not the best source for help. But to be fair, when working with the original zip file I can't even get it to upload without errors, so who knows.