-
Posts
1360 -
Joined
-
Last visited
-
Days Won
66
Everything posted by Geep
-
At this point, I will turn to edit the .po files (and sometimes english.pot), under the trunk's SVN checkin/checkout control. Summary lines about edit sessions, besides in the SVN revision log, I'll post within public notes at: 0006736: Strings framework: consume all.lang directly in UTF-8 Given our new policy, I will not be back-porting these pot/po changes to all.lang or *.lang. So the latter will become stale. The revised all.lang (and all_lang_to_po) have served a good purpose as a one-shot stepping stone to structured .pot/.po files. (For FMs, such a transition is yet to come, and might be helped by all_lang_to_po.) The initial edits will focus on removing errors/warnings detected by poedit. Then follows the bulk of the work, for missing translations.
-
I'll just use that in any future pot/po updates OK then. For core, we can move away from all.lang (and use of all_lang_to_po) to editing .pot directly. I believe poedit has claimed features for updating POs after changing POT. Whether they are adequate by themselves, or need additional management tools, is to be determined. Before all.lang abandonment, there's some preamble comments that I may need to review & perhaps partially migrate to a read.me or wiki page.
-
The newest .pot & .po files in my .zip available through the new wiki page do address items (1) & (2), as well as spacing between blocks in the .pot file. You do need to change your code to turn #empty back to "". For (3), I still wish you'd customize your code to provide what the i18n .map files traditionally did. Do you have a strong preference for the chunked-style or long-line style? I'm torn myself. Long-line is closer to the traditional TDM *.lang style. Chunked is the traditional gettext style, and so most-likely to be broadly compatible with 3rd party po/pot editors & other gettext tools. Poedit can handle either. For core, I'm OK with abandoning the non-English sections of all.lang. Simplicity would call for abandoning the [English] section as well, and just treating english.pot as the "source" going forward. However, there is a case for keeping the all.lang [English] section alone as the "source", from which english.pot is generated... mainly to discourage too-casual/too-frequent changes to english.pot and the synchronization headache with .po changes. There is a block flag that can be set (gettext's "fuzzy", seen as "needs more work" toggle in poedit). I didn't think I could reliable determine the initial value of this, so left it unset by all_lang_to_po's generation of .pot and .po . But something to look into further. In your numbered list, around 3 & 4, there is more work on my end across all the po files, to understand and correct fatal problems (mismatched printf specifiers) and non-fatal warnings (punctuation). And then there are all the missing strings to use AI to fill in. I'm away again, but expect to start working on these next week. We will have to figure out how you & I can work together on editing files without stepping on each others work. Another thing that I would add to future issues, perhaps the most helpful of all, would be the ability to specify the aspect ratio applied to a particular string in a particular font for a particular language.
-
@stgatilov, I just added a new wiki page: https://wiki.thedarkmod.com/index.php?title=Converting_Translations_with_all_lang_to_po from which you can download (at the bottom) a zip file that contains - source code & Windows executable for program "all_lang_to_po" v 1.00, the first public release of this. current input/output files The wiki page describes both the program, the required input markup for all.lang, and the results. I'm sorry it's not as tightly written as would be ideal.
-
As a workaround, open the .pot file in poedit, then resave it. It will add the spacing. I see all_lang_to_po does generate the .po with spacing, but not the .pot. I'll update the code to make that better.
-
Hmmm, po also uses leading # for comments generally, so the use of # isn't going to scream "TDM-specific". That said, I'm ok with #empty. For the group comments where I was using msgctxt "//", I'd like to keep it short. How about "##"?
-
@stgatilov, I'm traveling and away from my dev machine. And involved with family stuff. Be back Thursday. As for the empty string issue, we could adopt a convention msgid __empty__ is treated as"" by TDM engine
-
I do intend to post all_lang_to_po program and its source, probably in a week after some travel. Looking forward, if the TDM engine can successfully suck in .po (or even .mo) files directly, then, for non-English, the .po can be used as ground truth (that is, where further edits occur), and the all.lang [non-English] sections abandoned. The jury might be out as to whether to continue to support all.lang[English], or abandon that as well in favor of the .pot file as ground truth. In any case, the all_lang_to_po program could be refocused to help existing translated FMs make the transition to .po as well (after 2.15), if desired.
-
@stgatilov, here is a release of the generated .po files with the *existing* translations for every TDM language in all.lang Generated_po_files_Oct_14_2026.zip The zip file has this content: [from_all_lang_to_po_v0.12] all.lang input file [with_chunking] tdm_main.pot, *.po, comand_line_output.txt [with_long_lines] tdm_main.pot, *.po, comand_line_output.txt [poedit_3.10_resave_with_po_tweaks_&_mo_gen] [from_chunking_with_poedit_wrap_on] tdm_main.pot, *.po, *.mo [with_long_lines_with_poedit_wrap_off] tdm_main.pot, *.po, *.mo [draft doc] Generating POT & PO Files and their Headers.docx The data for chunking and long-lines is equivalent; just the internal file structure differs. When opened in PoEdit, the .po files generally exhibited some problematic rows, which PoEdit moves to the top. Typically, there were a handful of warnings (in yellow) and 1 or 2 severe errors (in red). On purpose, these are not corrected in this release. Each .po file was saved, which can alter the internal file structure & header (i.e. "PO tweaks") but not what is shown visually. The saving also generated a .mo binary file. For files with red errors, during save you get a warning that the "MO file probably won't work". Many of the red errors were due to strings that had printf format specifiers (e.g., "%i"), and where the number of spec fields in English differed from that of the translation. Since the same culprits turned up across languages, perhaps the translations were right at one time, but now stale after code revisions. Only languages without red errors at moment are: russian, turkish, and the overwhelmingly-incomplete dutch & swedish. The draft Word doc supplements (i.e., not an update) the draft doc in my earlier release above.
-
I'm now generating all the non-English .po files from the corresponding [lang] sections of all.lang, without generation-caused poedit errors. There's still lots of improvements to be done - extent of chunking, treatment of translator's comments, info in headers, etc. It is interesting that poedit visually flags inconsistencies between the English and translated syntax, e.g., whether or not they start with capital letters, end with periods, or have trailing space. Probably most of these deserve translation corrections (eventually), tho some could be compromises by translators trying to stuff words into limited space.
-
@stgatilov, here is the sample you requested: Generated po examples.zip The zip contains: "Converting with the all_lang_to_po Program.docx" [draft doc - discusses the current all.lang markups & results] all.lang - latest version of reworked [English] section with markups for .pot/.po gen. That was read by my all_lang_to_po program [working v9] to generate these files: [chunked lines] tdm_main.pot english.po [long lines] - i.e., with "-long" option tdm_main.pot english.po "all_lang_to_po console output.txt" - output for [chucked lines] would be the same, except for -long option. If you read any of the generated files into poedit [free version], then save, the resulting file will differ. This will be looked into further. Be aware of poedit's Settings/Advanced, tho the relationship between those claimed settings and what you actually get is not so clear. The all_lang_to_po program is a work in progress, and not fit to be released yet.
-
I'm finishing up a round of all[English].lang markup, and should have that, and the generated .pot and english.po files, for you later this week.These will be drafts, but in pretty good shape. Other generated language .po files will be after that. These will follow the .pot template, but add translations from all.lang. For that, more coding will be needed, but shouldn't be too bad, given my recycled infrastructure.
-
I've been experimenting with different markups (and corresponding conversion code), trying to balance readability in all.lang and in poedit. I have one now that seems good enough, so I'm applying it throughout all.lang[English]. Details later.
-
Yes, long-lines works OK with poedit (when wrapping turned off in Settings/Advanced). Thinking about the group comments further, it's probably not a good idea to use empty msgctxt as a flag for this, because it may conflate with future FM-specific po usage. Instead, what I've come up with using "//|" as a group comment flag in all.lang, which my program will then parse as putting "//" into pot's msgctxt and the rest of comment into msgid. Because poedit uses "|" to visually separate its display of msgctxt and msgid, this has the effect of making the all.lang entry and poedit entry visually similar. And translators familiar with C-language will see "//" as a comment. For example (with just a few lines in all.lang edited for group comments): BTW, I'm thinking to move away from using the "====" to indicate main headers, and just using prefixes like "1)", "1.1)", "1.1.1)".
-
Hmmm, just thinking to use empty or missing msgctxt to achieve same goal. I'll experiment a bit. At moment, seeing if I can just keep long lines (instead of chucking), and use settings in poedit to accept them. I've added a command-line option switch for this behavior.
-
It occurred to me that (unlike msgid) msgctxt doesn't have to be unique (I think). In that case, we could use a tag without a unique suffix. For instance, #comment or #note. Or even better, just "-" or "". The "" choice could be implemented by not including msgctxt at all in the block. In all.lang, we'd have to have some markup to differentiate comments into (at least) two classes: associated with particular #str_id or not; group, heading, or more general info. so that my program can do the proper conversion. I'm thinking something like "//-" or "///" for the second case, with just "// " for the first case.
-
As I mentioned, msgctxt is shown in blue (here with our #str_id) followed by "|" and msgid. The item I selected in my screenshot didn't have preceding comments. Here's an example that does: As you can see, this not so helpful when there's a bunch of preceding comments that - like here - are really group comments. For those, I proposed #str_i18n..., which would be helpfully visible as headings/notes in the main list. I agree that hack is not ideal. How about we invent a different indicator, like #note_... (otherwise same syntax treatment as #str_..., but ignorable by engine)?
-
I don't disagree, but there are important practical reasons why what I propose (Format C) is better, which I gather (i.e., AI sez) is often the po/pot solution used by translation projects with placeholder IDs. Here's what Format C looks like in poedit. This began with my freshly-generated .pot from revised all.lang[English]. That was then opened in poedit, and a "French" translation (fr.po) started (with empty translations; eventually I'll prepopulate *.po with existing translations from all.lang). Observe in the main panel, on the "Source text -- English" left side, each line shows the #str_id (in blue, from msgctxt) and then the English text (from msgid). Furthermore, there is a translation suggestion into French on the right. Such suggestions would not be provided if the English text was not in msgid.
-
Yeah, had to implement line-length chunking to make it gettext compatible. Headaches due to Windows vs Linux line endings too. Mostly fixed now.
-
FYI. I'm generating english.po files now, but getting some spurious "duplicate entry" errors in poedit. Still diagnosing, but possibly related to line-length issues.
-
Or maybe I'll just keep it simple, as #str_i18n_, e.g. "#str_i18n_std_inven_cat1" "STANDARD INVENTORY CATEGORY NAMES" "#str_i18n_std_inven_cat2" "These are often checked for in scripts."
-
OK, I'm generating .pot in Format C, and it's poedit-friendly. One of the remaining issues is that all.lang has useful heading comments, e.g., indicating a category, that apply to a group of subsequent #str. But in the generated .pot file, they are currently associated as comment(s) attached to the first #str in a group, but visually buried. I think I'll change all.lang to have additional "meta" strings, with ids of form: #str_i18n_group_... #str_i18n_note_... For example, consider the all.lang category and note: // STANDARD INVENTORY CATEGORY NAMES // These are often checked for in scripts. These might become: "#str_i18n_group_std_inven_cat" "STANDARD INVENTORY CATEGORY NAMES" "#str_i18n_note_std_inven_cat" "These are often checked for in scripts." Or alternatively, if the second line is less important to see at a glance in the poedit UI, it could be left as a comment but moved within all.lang: // These are often checked for in scripts. "#str_i18n_group_std_inven_cat" "STANDARD INVENTORY CATEGORY NAMES" Then in poedit when the #str item is selected, the comment would be seen in the sidebar (otherwise visually buried).
-
@stgatilov - I might add, gettext-compliance requires that the msgstr field in the .pot file is always left empty. So editors will barf if you try to stick the English there.
-
Hmm, it now appears that Format B would prevent me from using built-in AI translation with gettext-compliant desktop editors like poedit. Consider 2 more variants that make use of the msgctxt ("context") field: Format C (A variant of Format A that can use AI directly) #. Used after applying the holy water. Appears also in inventory: msgctxt "#str_08610" msgid "Holy Water Arrow" msgstr "" // Will be filled in to make language-specific .po Format D (A variant of Format B that still can not use AI directly, but could be manually script-swapped to Format C, more readily than B). #. Used after applying the holy water. Appears also in inventory: msgctxt "Holy Water Arrow" msgid "#str_08610" msgstr "" // Will be filled in to make language-specific .po Swapping manually would be a pain, so I'm leaning towards C. Enterprise-level translation systems (cloud or desktop) have that kind of swapping (and other good stuff) built-in, but probably too pricey for us.
-
I'm got this. Easy to adapt from my C++ pivot_all_lang program. Basics are mostly working for .pot file gen, but needs a bit more work on header & comments. Then expand to do gen .po files. I've downloaded the poedit editor. Just kicking the tires on the free version so far. There's some paid versions that tie in with AI translations, and that may be worth it for me (at least for a year: $40 for Pro+). I've also downloaded a github project with a set of sample/text .po (and .pot) files for > 200 languages & dialects. Very helpful. Gettext supports languages with more than 2 singular/plural forms in the .po file. It fires when given a numeric value, e.g., in a "%d" string format, and applying a categorization do that number based on a c-style rule description. Evidently some of our languages are best translated with that feature. With 3 forms: Spanish, French, Italian, Polish, Portuguese, Romanian, Russian. This is not high priority, but presumably our "Translate()" function could do likewise.