mickabouille Posted August 2 Share Posted August 2 (edited) Hi, I was writing a small tool/script to work on weidu tra files and expected to be, well, not that hard. But then after naively pumping out code I noticed I had forgotten things. This is not enough ``` @<id> = ~text~{~text~} ``` (with {...} meaning optional) Even when allowing both ~ and " as string delimiter (those are the only two, promise?) and comments. Because I had TRAs with `[sound]` too! ``` @<id> = ~text~{[sound]} {~text~} {[sound]} ``` And then I found some TRA files with **negative** indexes Well, looking at the weidu doc, I couldn't find a description of the format, not in the sens that we have a semi-formal description of the .D format. Well it seems maybe it was an extension of .D files themselves(?) Or do we have one and I couldn't find it? Do I have everything or am I still missing parts: - comments with `// - Do we have `/* */` too? Can we put those between `@123` and `=` or somewhere else in the middle of an entry? - an id in the form `@<number>` including negative numbers - strings enclosed in tildas (with no tildas inside) or double quotes (with no double quotes inside) - one or two string with zero, one or two sound labels - Uh what characters are accepted in the sound label by the way? Probably not `]` I suspect, but any other restriction? This was supposed to be a peaceful, relaxing, leisurely activity (and then "let's write a LALR grammar"...) Edited August 2 by mickabouille Quote Link to comment
argent77 Posted August 2 Share Posted August 2 1 hour ago, mickabouille said: - strings enclosed in tildas (with no tildas inside) or double quotes (with no double quotes inside) That's not all. Strings can also be enclosed in percent signs (%) or five consecutive tildes (~~~~~). And string concatenation is most likely also supported (string1 ^ string2). The translation string syntax is mostly covered in the WeiDU D format description (see the Text and String subsections). Quote Link to comment
medic2000 Posted August 3 Share Posted August 3 Is there any TRA file editor that allows us only deal with text and not mess any of the special characters? Quote Link to comment
lynx Posted August 3 Share Posted August 3 Yes, for mods that use burner1024's converter to PO files — you can use any proper translation tool then, including his instance of (pootle). A good way to benefit from a translation memory. Quote Link to comment
mickabouille Posted August 3 Author Share Posted August 3 (edited) 11 hours ago, argent77 said: That's not all. Strings can also be enclosed in percent signs (%) or five consecutive tildes (~~~~~). And string concatenation is most likely also supported (string1 ^ string2). The translation string syntax is mostly covered in the WeiDU D format description (see the Text and String subsections). I was hoping this unnecessary cruft would have been banned from TRA to make it an inert data format Wait does that mean you can do that too? @2 = @1 ^ @109 ^ #234 @1 = @2 ^ @109 EDIT: and, eh... This five tildes things is a pain, talk about grammar conflicts Edited August 3 by mickabouille Quote Link to comment
argent77 Posted August 3 Share Posted August 3 1 hour ago, mickabouille said: Wait does that mean you can do that too? @2 = @1 ^ @109 ^ #234 @1 = @2 ^ @109 No, you can only concatenate strings. E.g. @1 = "This is" ^ ~ a string.~ @2 = %This is% ^ ~~~~~ another string.~~~~~ Quote Link to comment
mickabouille Posted August 3 Author Share Posted August 3 (edited) Well, after testing, I'm somewhat relieved to confirm that you can't do @10 = ~something~ ^ @11 BUT you can do @10 = @11 @10 = #1234 //also works And @10 = @11 @11 = @11 is just a stack overflow EDIT: mostly in sync Edited August 3 by mickabouille Quote Link to comment
mickabouille Posted August 3 Author Share Posted August 3 (edited) > No, you can only concatenate strings. Ah ok, this is what I call string literals. Edited August 3 by mickabouille Quote Link to comment
mickabouille Posted August 3 Author Share Posted August 3 (edited) And of course you CAN put multiple entries on the same line (I guess you could put your entire TRA file on a single line). And you can't do @12 = ~some text~ @13 which I admit would be confusing semantically. And, (wooot) this works! @11 = ~Something~ /* comment */ ~Something else~ (sob ) Edited August 3 by mickabouille Quote Link to comment
medic2000 Posted August 3 Share Posted August 3 (edited) 5 hours ago, lynx said: Yes, for mods that use burner1024's converter to PO files — you can use any proper translation tool then, including his instance of (pootle). A good way to benefit from a translation memory. I didn't understand any of this. - Who is burner1024? - What is PO file? Why would i convert to PO file? - What is pootle? - How will I know if a mod uses burner1024's converter to PO files? BG1 NPC Project? - Any proper translation tool? For example? I only know DeepL. Edited August 3 by medic2000 Quote Link to comment
mickabouille Posted August 3 Author Share Posted August 3 (edited) So, I just tested `@11 = ~~~~~~~~~~~~~~` (How far am I gone?) and weidu doesn't want anything to do with it (it should mean `~~~~`) Even `@11 = ~~~~~~~~~~~` doesn't work (it should mean `~` On the other hand `@11 = ~~~~~ ~~~~ ~~~~~` works and shows `~~~~` So now my parser is more correct than weidu... which is a problem because I don't intend to RE the exact behavior. (Seems I am neither on Earth nor on Faerûn, that's maybe be the Fugue plane?) Edited August 3 by mickabouille Quote Link to comment
kjeron Posted August 3 Share Posted August 3 33 minutes ago, mickabouille said: `@11 = ~~~~~~~~~~~~~~` and weidu doesn't want anything to do with it (it should mean `~~~~`) Even `@11 = ~~~~~~~~~~~` doesn't work (it should mean `~` On the other hand `@11 = ~~~~~ ~~~~ ~~~~~` works and shows `~~~~` So now my parser is more correct than weidu... which is a problem because I don't intend to RE the exact behavior. You have an empty string "~~~~~~~~~~" followed by four tildes, not four tildes within two instances of "~~~~~". A string ends at the first instance of it's delimiter. "~~~~~~~~~~~~" (12x) will work, because it reads two empty strings: "~~~~~~~~~~" and "~~". If you want tildes within a string like that, you need to use either " or % as the delimiter, or use a variable. Quote Link to comment
mickabouille Posted August 3 Author Share Posted August 3 (edited) Doesn't the weidu doc say "five consecutive tildes on each side"? Edited August 3 by mickabouille Quote Link to comment
argent77 Posted August 3 Share Posted August 3 @1 = ~~~~~~~~~~~~ // (12x) seems to work because WeiDU interprets it as two consecutive string literals (male and female string) without having any whitespace in between. It is functionally identical to @1 = ~~~~~~~~~~"" or @1 = ""~~~~~~~~~~ or even @1 = ~~~~~~~~~~[]~~[] // two strings with empty sound references Quote Link to comment
mickabouille Posted August 4 Author Share Posted August 4 (edited) That's disturbing. Anyway, this five tildes things has no real use (given we already bear the cost of concatenation support) and it I only (barely) care about it because one of my test case (the tra-ified bg1ee tlk) contains @30 = ~~~~~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*() -_=+\|]}[{;:'",<.>/?–— ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿœŒ€£~°µ~~~~~ So I'll probably disregard the more complex cases. Edited August 4 by mickabouille Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.