Translation hints

Multi-language server and extension for vscode-based editors. Supports various Infinity Engine and Fallout syntaxes.
Post Reply
User avatar
Magus
Site Admin
Posts: 496
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Translation hints

Post by Magus »

Translation hints come in form of hover tooltips
weidu-tra-tooltip.png
weidu-tra-tooltip.png (53.8 KiB) Viewed 26753 times
fallout-tra-tooltip.png
fallout-tra-tooltip.png (68.81 KiB) Viewed 26753 times

And inlay hints.
fallout-inlay-hints.gif
fallout-inlay-hints.gif (69.2 KiB) Viewed 26753 times
weidu-inlay-hints.gif
weidu-inlay-hints.gif (85.31 KiB) Viewed 26753 times

To allow hints to work, you need to tell MLS where to find the translation. It's done in .bgforge.yml file, which you should place into root of your project.

Code: Select all

mls:
  translation:
    directory: data/text/english/dialog
    auto_tra: true                         # optional, if not specified defaults to true
Virtually everyone will only need the directory setting.
The system works similarly to WeiDU's AUTO_TRA. You specify the directory, and the files are matched by their basename.
So, "smarter_familiars.d" file will be matched with "smarter_familiars.tra".
For Fallout, that's pretty much how it always worked, script names match their msg names.

However, any file may be directed to get the translation elsewhere explicitly. This is done with a special @tra tag, which must be on the very first line, like so (see first screenshot).

Code: Select all

/** @tra smarter_familiars.tra */
Filename specified here is relative to the translation directory specified in .bgforge.yml.
It's also possible to use a subdirectory:

Code: Select all

/** @tra mycomponent/smarter_familiars.tra */
Note that using the tag requires lowercased filenames. (Although in general, your whole mod directory should be lowercased anyway.)


Hover tooltips are normal hovers. Hotkey for inlay hints is Alt-Ctrl.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
QuantumApprentice
Posts: 6
Joined: Sun Aug 21, 2022 12:46 am

Re: Translation hints

Post by QuantumApprentice »

Just wanted to drop this on ya in case you weren't aware already:
Inlay hints is cool, works for the most part, but I discovered today it doesn't seem to work for gSay_message() for some reason:
Image
User avatar
Magus
Site Admin
Posts: 496
Joined: Mon Nov 21, 2016 9:13 am
Contact:

Re: Translation hints

Post by Magus »

Correct.
But if you check the original scripts, you'll see that gSay_Message is pretty much never used directly, only in GMessage/NMessage/BMessage macros. It's probably a better practice to follow that convention.
These macros also don't show hints now, but I added the capability, and they will in the next version.
Please do not PM or email me about my mods and projects. Use forums. Also, see our talk channels.
Post Reply