Add tool: LcfTrans#21
Conversation
|
It's a really good idea ^^. That sure will be usefull for the editor! A french guy did a similar program called DreaMaker. I used it to translate a game, it was usefull but had some problems. |
|
Yeah I know that tool. Well "Not invented here". The tool has some Problems: No sourcecode, not Multi platform, translation file format is non-standard. Usually I prefer reusing existing stuff but here I made an exception to gain extra flexibility. And my motivation was not to support writing the strings back into the binary files but to support multi-language in Player, and this is the first step to it. |
|
Oh yeah of course I was not saying "you should use it" but just "extract string is a really good idea". I have no doubt that your implementation will be more suitable to your goals ^^. |
|
Looking forward to the first multilanguage versions of Yume Nikki and Ib :P |
|
The Player will be abble to switch from a trad file to another :p ? |
|
before 2017 :P. So you can start translating your favourite game to French already :P |
|
Omg great Ghabry! |
|
|
||
| Syntax: `xyz2png file1 [... fileN]` | ||
|
|
||
| * LcfTrans: extracts text out of LMU and LSD files and creates po files. |
There was a problem hiding this comment.
The database file is LDB, not LSD. Same mistake in lcftrans/README.md.
|
It produces erroneous output when using two consecutive line breaks. msgctxt "event"
msgid ""
"foo\n"
\n"
"bar"
msgstr ""
+1 to that. Besides DreaMaker, there's also RPGMaker Trans, GPL and supports from 2k to VX Ace. |
| @@ -0,0 +1,12 @@ | |||
| bin_PROGRAMS = lmu2png | |||
There was a problem hiding this comment.
This is an oversight and needs to be changed in the whole file ;-)
i.e. sed 's/lmu2png/lcftrans/g' -i lcftrans/Makefile.am
|
Thx for your feedback. The issues reported by zegeri and carstene1ns got fixed |
|
@sorlok It generates now the following files:
How message strings are constructed: A new message starts at a Lonely A Choice is merged with the previous message when it fits in the window (message lines + choices <= 4) Except for the first two commits I killed now all further commits. For historical reasons they can be found here: The code is now much cleaner, I can see that my C++ expertise increased alot in the last 4 years. The old code was terrible. The only open research point is providing Translation comments and Line information (both useful for translators to find the string origin). |
|
I'm emitting now the following human readable info lines (also powered by ForEach, very nice API :)).
When there is a Choice the following is emitted:
I consider adding a |
|
Aaand here is the Update feature. It is very naive: I just loads an existing Po file and then checks if
When 2 is true: Merge |
34fdfd4 to
5cf7167
Compare
Ghabry
left a comment
There was a problem hiding this comment.
@fmatthew5876
Can you tell me if some of my template foo is bad? At least my brain is exhausted now ;)
| if (!ctx.parent || !ctx.parent->parent) { | ||
| // Read events | ||
| lcf::rpg::ForEachString(root, [&](const auto& val, const auto& ctx) { | ||
| if (!isEventCommandString(ctx) || !std::is_same<decltype(ctx.parent->obj), std::add_pointer_t<ParentType>>::value) { |
There was a problem hiding this comment.
I use the ParentType to type filter because I must do a distinction between common event and battle event (they both have the same root lcf::Data::data (the database).
Is this a good way to do the filtering? My old check was a string comparison but imo this is more robust.
There was a problem hiding this comment.
You should consider taking this whole lambda and dispatching to another function with a null base case and an implemented EventCommand case.
The problem here is that because this lambda is compiled for every possible type, you need all these wrappers to make it compile. So for example rpg::Actorm the compiler will run through this code and compile all of it and complain if any of it doesn't compile.
By dispatching early, you get out of "generic" world and into "EventCommand" world. As soon as you do that, you can just directly get the code, indent, etc.. without all the wrappers, making your code cleaner and more readable.
For the parent filtering, the way it's written yes you need to do that if statement.
However, another way if you already have the ParentCtx object, that has the struct, so instead of calling ForEachString on the database root, call ForEachString on the CommonEvent / Troop parent directly. Then you need don't need the is_same stuff.
If you call ForEachString on a child node, it would be useful to have the full context if possible, so it matches the same context type you would get if you called with db.
There was a problem hiding this comment.
because I needed lots of state I created a small class with two parse methods: One for evt commands, one "catch-all".
Helped to simplify the code alot 👍
37509b4 to
5dfd1ea
Compare
|
Found a small bug. Previously, running on The Blue Contestant, for skills, I get: On the latest commits, I get: The context is garbled (should be "skill.description"). |
|
@sorlok Try a clean rebuild of liblcf again, then compile lcftrans again (or fetch the binary from the PR builder - just expand the "All checks have passed" message) |
|
Just wanted to check in and see what the status is on this. |
e2a0b64 to
32f60f6
Compare
|
Interestingly the editor doesn't allow an empty line on line 4. Which confirms that this is for aligning num input or choices :) @sorlok should work now. For some unrelated reason Windows PR build fails though. Choices are splitted. Editor input: Tool output: |
Add LMT support
Translated strings that are not found anymore in the original are moved in a OUTFILE.stale.po.
|
Imo @sorlok should have the final word here. When we get an agree from you that the format is fine now this can be merged :) |
|
Thanks @Ghabry. The sample text you provided look good. I'm running through and updating the Aurora's Tear translation and checking, just to make sure nothing else stands out. Once that's done I'll let you know! |
|
It looks good. I actually used the "-u" flag on my current Aurora's Tear translation, and it showed me exactly what changed. This can be merged, as far as I'm concerned. |
|
Thanks for also independently testing the "-u" flag, I always only used artificial translations to test it. |
This is a tool I'm working on since months (with big breaks in between).
It goes through the LDB file and all LMUs and extracts strings out of it and writes them in a po file.
Strings with same content and context are merged into one (Required by the format)
Writing back is NOT supported. Rendering this tool semi-useless currently because you can't do anything with the translations :(
A super simple po reader exists (
fromPO) which can be used as a base.Not sure if writing back makes sense at all. The ultimate goal would be adding "loadTranslation" to liblcf and support on-the-fly language switching ingame this way.
The tool lacks some polishing: