Forum: CAT Tools Technical Help
Topic: Looking for ideas to translate a source code file
Poster: Samuel Murray
Post title: @Shirikka
[quote]Shirikka wrote:
// RESOURCEID=ID_TXT_MENUPKT200
_T("STATISTICS"), [/quote]
How sure are you that the translatable text is *always* preceded by [b]_T("[/b] and *always* followed by [b]"),[/b]? Does it always use double quotes, or does it sometimes use single quotes? Does it always have no space between the closing bracket and the comma, or is there sometimes a space or a tab between the closing bracket and the comma? It is my experience that programmers typically write neatly, but sometimes write sloppily in ways that are still acceptable for the compiler but which is not consistent from a human reader perspective (such as using single quotes instead of double quotes in some places, if the compiler doesn't care about single vs double quoting).
[quote]
Any ideas of a software who could help me translate source code easier? [/quote]
Well, one thing you can try, is this:
0. Open in a text editor (make sure it opens in the correct text file encoding)
1. Replace all tabs with something temporary, e.g. {{TAB}}
2. Find this: [b]_T("[/b]
Replace with this: [b]_T("[/b] plus a TAB
3. Find this: [b]"),[/b]
Replace with this: a TAB plus [b]"),[/b]
4. Copy all text, and paste it into Excel
5. The translatable text should now be in column B. Insert an extra column next to column B. Copy column B to a text editor, translate it in Google Translate, etc, etc, but make sure that you don't remove any empty lines in the process.
6. Paste the translation back into Excel, in the newly inserted column C. This should put the source and translation side by side, so that you can check the translation.
7. When you're done, delete column B.
8. Copy everything back into a text file. Delete all TABs (i.e. replace TABs with nothing). Replace any {{TAB}} with real tabs again. Save as a .h file. Hope for the best.
[Edited at 2019-05-22 07:35 GMT]