LangPeeker: Difference between revisions
article created |
→Downloads: Add link to license |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
''by Geep, May, 2025'' | |||
''by Geep, 2025'' | |||
== Introduction == | == Introduction == | ||
LangPeeker is a standalone Windows utility program, to help fast deciphering of TDM localizations. You can use it to quickly lookup international-language information about specific #str_<id> strings used in an internationalized FM of interest and/or base TDM (e.g., menus). It could be helpful for a developer reviewing in DR an existing, unfamiliar FM that offers localization. | LangPeeker is a standalone Windows-desktop utility program, to help fast deciphering of TDM localizations. You can use it to quickly lookup international-language information about specific #str_<id> strings used in an internationalized FM of interest and/or base TDM (e.g., menus). It could be helpful for a developer reviewing in DR an existing, unfamiliar FM that offers localization. | ||
LangPeeker is a viewer, i.e., no editing. It presents 3 tab panes: | LangPeeker is a viewer, i.e., no editing. It presents 3 tab panes: | ||
Line 20: | Line 19: | ||
When configuring LangPeeker for a new project, start with the "Settings" tab page, and fill in one or (as in Figure 1) both of the "Folder" fields. | When configuring LangPeeker for a new project, start with the "Settings" tab page, and fill in one or (as in Figure 1) both of the "Folder" fields. | ||
[ | [[File:Langpeeker settings.jpg|frame|none|'''Figure 1.''' "Settings" with both Folder fields filled in and the checkboxes set. After that, the "Apply and Test" button was pressed, resulting in the popup dialog shown.]] | ||
Figure 1. "Settings" with both Folder fields filled in and the checkboxes set. After that, the "Apply and Test" button was pressed, resulting in the popup dialog shown. | |||
If you touch the info icon to the right of the "FM Folder" field, you'll see this text: | If you touch the info icon to the right of the "FM Folder" field, you'll see this text: | ||
Line 71: | Line 68: | ||
== Search == | == Search == | ||
[ | [[File:Langpeeker search.jpg|frame|none|'''Figure 2.''' A typical successful search, with English results, for the configuration given in Figure 1. The author of the FM's content string in this case has included some explicit linebreaks (as "\n"; one actually starts the string). These will be treated as linebreaks in the "Contents as Multiple Lines..." pane. But one resulting line was still too long to view except with horizontal scrolling, so "Word Wrap..." was momentarily turned on.]] | ||
Figure 2. A typical successful search, with English results, for the configuration given in Figure 1. The author of the FM's content string in this case has included some explicit linebreaks (as \n; one actually starts the string). These will be treated as linebreaks in the " | |||
=== Search Term Entry and Language Choice === | === Search Term Entry and Language Choice === | ||
Suppose you are examining some aspect of an FM in DR or a text editor, and you start to encounter some #str_<id>s. You can configure LangPeeker for that FM (if not already done). Then, copy/paste or type a given #str_<id> into LangPeeker's search field, followed by <Enter>. Use the "Language" pull-down to choose among all the TDM-supported languages, keeping in mind for FMs, available translations are quite limited. | Suppose you are examining some aspect of an FM in DR or a text editor, and you start to encounter some #str_<id>s. You can configure LangPeeker for that FM (if not already done). Then, copy/paste or type a given #str_<id> into LangPeeker's search field, followed by <Enter>. Use the "Language" pull-down to choose among all the TDM-supported languages, keeping in mind for FMs, available translations are quite limited. | ||
Line 84: | Line 79: | ||
For a given language, the matching text line in a .lang file is shown, broken up into 3 fields. The "within" field says which file was the source. If not found, that field will say so, and all other fields will be blank. | For a given language, the matching text line in a .lang file is shown, broken up into 3 fields. The "within" field says which file was the source. If not found, that field will say so, and all other fields will be blank. | ||
== Coverage == | == Coverage == | ||
[ | [[File:Langpeeker coverage.jpg|frame|none|'''Figure 3.''' The "Coverage" page, for the configuration given in Figure 1. While the TDM base provides a full set of language files (e.g., for menus), this FM provides only English and German files.]] | ||
Figure 3. The "Coverage" page, for the configuration given in Figure 1. While the TDM base provides a full set of language files (e.g., for menus), this FM provides only English and German files. | |||
Given what you configured in Settings, this page gives a quick view of what language resources are available. Two of the data columns | Given what you configured in Settings, this page gives a quick view of what language resources are available. Two of the data columns simply reflect what you would see if you looked within the relevant file directories. The other two data columns indicate what you would know if there was an all.lang file and you surveyed [language] headings within it. | ||
In addition, where redundant data sources are available, symbols indicate which source will be consulted and which ignored. | In addition, where redundant data sources are available, symbols indicate which source will be consulted and which ignored. | ||
Line 99: | Line 92: | ||
Settings are saved as Properties, structured during development through the VS IDE, and stored in its own MS-specific format in the Properties/Settings.settings xml file. | Settings are saved as Properties, structured during development through the VS IDE, and stored in its own MS-specific format in the Properties/Settings.settings xml file. | ||
=== Known Limitations === | === Known Limitations === | ||
==== Platform and Install ==== | |||
* This was developed under Windows 11 with .Net Framework 4.8 and Visual Studio Community 2022. | |||
* A WinForms app like this is Windows-specific. [Geep sez: Anyone else is welcome to explore a similar app for Linux. Or provide similar functionality within DR.] | |||
* This was built with .Net Framework 4.8; if your Windows install was done from 2019 on, you should have this already, and be able to run this app, with codepage conversions succeeding. (The app could have been built with the latest successor to .Net Framework and .Net Core, e.g., .Net 9, but then it might require you to install a newer version of .Net, with little advantage for this app.) | |||
* LangPeeker is distributed as a zip file, without installer. After download and unzip into a folder, copy the folder (with both LangPeeker.exe and various .Net dlls) to your desired location. Run the .exe, and maybe pin to your taskbar. | |||
==== Functionality ==== | |||
* Because LangPeeker is oriented towards unique search terms, only the first hit is found; there is no "Next" button (or internals to handle such). | * Because LangPeeker is oriented towards unique search terms, only the first hit is found; there is no "Next" button (or internals to handle such). | ||
* Unlike [[Gen Lang Programs]], LangPeeker does not do a file pre-scan to remove potentially multiline comments of the form /* ... */. This may lead to an occasional false hit. | * Unlike [[Gen Lang Programs]] and [[I18N.pl]], LangPeeker does not do a file pre-scan to remove potentially multiline comments of the form /* ... */. This may lead to an occasional false hit. | ||
* LangPeeker uses standardized conversions, which represent precisely what is in the .lang files, but neglects TDM-code remappings of a few characters. | * LangPeeker uses standardized conversions, which represent precisely what is in the .lang files, but neglects TDM-code remappings of a few characters. | ||
==== Imagined Additional Capabilities ==== | |||
''[Geep notes: There are no plans for these features at this time; some require substantial work. Will a demand for them develop?]'' | |||
* visually indicate in Search's "Language" dropdown what languages are not available. | * visually indicate in Search's "Language" dropdown what languages are not available. | ||
Line 115: | Line 113: | ||
* and of course editing. | * and of course editing. | ||
==== Internal Structure ==== | |||
See comments in the source code. | |||
== Downloads == | == Downloads == | ||
[ | Version 1.0 | ||
[ | * Exe and associated .Net DLLs: [https://drive.google.com/file/d/1TeCaKzczn8y8MFIOlO9JXPz04BueznU8/view?usp=sharing langpeeker_exe_and_dlls.zip]. See also "Platform and Install" above. | ||
[ | * Source as VS project: [https://drive.google.com/file/d/12a7a2NrZXACvclGrARBJd5xy0X5ssvKR/view?usp=sharing langpeeker_source_project.zip] | ||
* Open source license for these: [https://drive.google.com/file/d/1mAhag1TtYT9stQiT2rQbtkPIBreB18-H/view?usp=sharing LICENSE.txt] | |||
== See Also == | |||
* [[Internationalization]] | |||
* [[Gen Lang Programs]] | |||
* [[I18N.pl]] | |||
{{editing}} |
Latest revision as of 19:38, 15 April 2025
by Geep, May, 2025
Introduction
LangPeeker is a standalone Windows-desktop utility program, to help fast deciphering of TDM localizations. You can use it to quickly lookup international-language information about specific #str_<id> strings used in an internationalized FM of interest and/or base TDM (e.g., menus). It could be helpful for a developer reviewing in DR an existing, unfamiliar FM that offers localization.
LangPeeker is a viewer, i.e., no editing. It presents 3 tab panes:
- Search
- Settings
- Coverage
When first used, you go to "Settings" and enter paths to the current FM and/or TDM installation. You may validate these by an "Apply and Test" button, which reports what language files are available to be searched. You get a brief popup report for English, plus an update to the full story for all possible languages under "Coverage".
Then at "Search", you enter a search term, with a language of immediate interest (like "English") selected. Most often, the search term is a specific #str_<id>, and you have constrained the search to just look among #str_<id> values for a match. It's easy to swap languages to see comparable results.
The results are broken into fields, with the string "Contents" field (of most interest) viewable in several forms.
Settings
When configuring LangPeeker for a new project, start with the "Settings" tab page, and fill in one or (as in Figure 1) both of the "Folder" fields.

If you touch the info icon to the right of the "FM Folder" field, you'll see this text:
- Typically holds full path to <tdm_installed>\fms\<fm> - Folder should contain <fm>_l10n.pk4 and/or unpackaged dev project. (If both, pk4 is ignored.) - LangPeeker will then look in /strings/fm/ for *.lang files. - For instance, an 'English' search would consult english.lang or the [English] section within all.lang - If you're just working on TDM base strings, leave this field empty, or set it here but skip it by unchecking Search tab's 'FM data'.
Similarly, the info icon for "TDM Folder" gives:
- Typically holds full path to <tdm_installed> - Folder should contain either tdm_base01.pk4 or unpackaged equivalent. (If both, pk4 is ignored.) - LangPeeker will then look in /strings/ for *.lang files. - For instance, an 'English' search would consult english.lang or the [English] section of all.lang - If you're just working on FM strings, leave this field empty, or set it here but skip it by unchecking Search tab's 'TDM data'. - But be aware that some FMs reference TDM base strings.
Additional checkboxes are:
- "Search FM before TDM". If you specify both an FM and TDM Folder path, this controls which is searched first.
- "As a data source, prefer all.lang over <languages>.lang".
To support its menu system, the TDM base distribution offers both UTF8 file all.lang, and a full set of <language>.lang files (of various codepage encodings). These two sources are largely redundant, so, when both are present, you must choose which one to search. Considerations are:
- All.lang is considered the "master source", from which the <language>.lang files are generated.
- All.lang is already in UTF8 form, so no conversion is needed.
- Optional comments are more present in all.lang (a 2-edged sword).
- <languages>.lang is what the game actually uses (with a few characters remapped at runtime)
The same considerations could apply to an FM with localizations, but it is rare at this time for the FM's all.lang file to be distributed.
To ensure app consistency and correctness:
- Any changes to the checkboxes, and to a Folder field selected by its "Browse" dialog, will be applied immediately.
- Any change to a Folder field by editing or cut/paste will be applied either when you hit <Enter> or do "Apply and Test".
Generally, this update process will be quiet unless a problem is detected. On the other hand, using "Apply and Test" - whose 'apply' is sometimes harmlessly redundant - pops up additional information, revealing how an 'English' search would be processed. An example is shown in the Figure.
Paths and checkboxes under "Settings" are remembered across sessions (unlike constraints on the "Search" page). Each folder field offers a history of up to 5 recent paths.
Search

Search Term Entry and Language Choice
Suppose you are examining some aspect of an FM in DR or a text editor, and you start to encounter some #str_<id>s. You can configure LangPeeker for that FM (if not already done). Then, copy/paste or type a given #str_<id> into LangPeeker's search field, followed by <Enter>. Use the "Language" pull-down to choose among all the TDM-supported languages, keeping in mind for FMs, available translations are quite limited.
Search Checkbox Constraints
Usually, you'll want to match only against the #str_<id> field in underlying *.lang files. But you can configure your search to include the string "Contents" field. You might do that if you remember a unique phrase from playing the game, and would like to determine its #str_<id>. The results found will then vary by language. For completeness, the "Comment" field (e.g., a line in all.lang that has "//...") can also be searched.
If in Settings you established both the FM and TDM Folders, you could, for a specific search, quickly limit it to just one or the other, with the Search checkboxes "FM Data" and "TDM Base Data".
Results
For a given language, the matching text line in a .lang file is shown, broken up into 3 fields. The "within" field says which file was the source. If not found, that field will say so, and all other fields will be blank.
Coverage

Given what you configured in Settings, this page gives a quick view of what language resources are available. Two of the data columns simply reflect what you would see if you looked within the relevant file directories. The other two data columns indicate what you would know if there was an all.lang file and you surveyed [language] headings within it.
In addition, where redundant data sources are available, symbols indicate which source will be consulted and which ignored.
Implementation Notes
Framework
This was rapid-prototyped in Visual Studio Community 2022 as a standard MS WinForms app, written in C#, and using .Net libraries.
Conversion of Data to UTF8
Search results are shown in UTF8 format. This is the native format for all.lang, so no conversion is needed for data drawn from there. Data from other <language>.lang files are not in UTF8, but in various codepages, mostly iso-8859-x, as detailed elsewhere. The facilities of modern .Net are used to convert to UTF8 after file read.
Persistence
Settings are saved as Properties, structured during development through the VS IDE, and stored in its own MS-specific format in the Properties/Settings.settings xml file.
Known Limitations
Platform and Install
- This was developed under Windows 11 with .Net Framework 4.8 and Visual Studio Community 2022.
- A WinForms app like this is Windows-specific. [Geep sez: Anyone else is welcome to explore a similar app for Linux. Or provide similar functionality within DR.]
- This was built with .Net Framework 4.8; if your Windows install was done from 2019 on, you should have this already, and be able to run this app, with codepage conversions succeeding. (The app could have been built with the latest successor to .Net Framework and .Net Core, e.g., .Net 9, but then it might require you to install a newer version of .Net, with little advantage for this app.)
- LangPeeker is distributed as a zip file, without installer. After download and unzip into a folder, copy the folder (with both LangPeeker.exe and various .Net dlls) to your desired location. Run the .exe, and maybe pin to your taskbar.
Functionality
- Because LangPeeker is oriented towards unique search terms, only the first hit is found; there is no "Next" button (or internals to handle such).
- Unlike Gen Lang Programs and I18N.pl, LangPeeker does not do a file pre-scan to remove potentially multiline comments of the form /* ... */. This may lead to an occasional false hit.
- LangPeeker uses standardized conversions, which represent precisely what is in the .lang files, but neglects TDM-code remappings of a few characters.
Imagined Additional Capabilities
[Geep notes: There are no plans for these features at this time; some require substantial work. Will a demand for them develop?]
- visually indicate in Search's "Language" dropdown what languages are not available.
- for a given #str_<id>, show where it is used, not just defined.
- have Coverage show, out of items needing translation for a given language, the percent completed.
- have some method of stepping through the needing-translation items.
- during results display, perhaps incorporate some smarts related to the actual TDM bitmap font that deploys the string.
- and of course editing.
Internal Structure
See comments in the source code.
Downloads
Version 1.0
- Exe and associated .Net DLLs: langpeeker_exe_and_dlls.zip. See also "Platform and Install" above.
- Source as VS project: langpeeker_source_project.zip
- Open source license for these: LICENSE.txt