AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Map Translator (Multilingual map texts) (https://forums.alliedmods.net/showthread.php?t=333658)

MsDysphie 07-27-2021 22:11

[ANY] Map Translator (Multilingual map texts)
 
https://i.imgur.com/f0mqJEq.png

Map Translator

Translates map texts via translation files, allowing players to see messages in their preferred language.


The following texts are supported:

- [ANY] game_text
- [ANY] env_hudhint
- [ZPS] Objective text
- [NMRiH] Objective text
- [NMRiH] point_message_multiplayer
- [TF2] game_text_tf

Installation

- Install Sourcemod 1.11.6924 or higher.
- Grab the latest release ZIP and extract to `addons/sourcemod`.
- Refresh your plugins (`sm plugins refresh` in server console)

Usage

- Navigate to `cfg/sourcemod` and open `plugin.map-translator.cfg`
Note: it's `plugin.nmrih-map-translator.cfg` in NMRiH for backward compatibility

- Set `mt_autolearn_langs` to a space-separated list of language codes you wish to generate translations for.

PHP Code:

// Example for English, Spanish and Korean
mt_autolearn_langs "en es ko" 

Note: You can see the full list of language codes at `addons/sourcemod/configs/languages.cfg`


- The plugin will now create translation files for maps as they're loaded.
They're stored in `addons/sourcemod/translations/_maps`

PHP Code:

"Phrases"
{
    
"edf566344eb9f2cb892e073e70c70181"
    
{
        
"en"        "Destroy the puppet"
        "es"        "Destroy the puppet"
        "ko"        "Destroy the puppet"
    
}


You can then edit these files to change the message printed for each language.

PHP Code:

"Phrases"
{
    
"edf566344eb9f2cb892e073e70c70181"
    
{
        
"en"        "Get rid of the puppet"
        "es"        "Destruye la marioneta"
        "ko"        "인형을 파괴해"
    
}



Admin Commands

PHP Code:

// Learns objective messages for every map without loading them in
mt_bulk_learn_nmo

// Forces your client language to the given language code. Useful for debugging
mt_forcelang <code>

// Only available in NMRiH, learns all .nmo files at once without having to load the maps in
mt_bulk_learn_nmo

// Forces the plugin to export all pending translations instead of waiting for a map change
mt_force_export 


CVars

CVars are read from `cfg/sourcemod/plugin.map-translator.cfg`

PHP Code:

// Don't translate or learn fully numerical messages such as codes, countdowns, etc. (Default: 1)
mt_ignore_numerical 1

// Space-separated list of language entries to include in auto generated translation files, for example: en es ko (Default: en)
mt_autolearn_langs "en es ko"

// Clients whose language is not translated will see messages in this language (Default: en)
mt_fallback_lang "en"

// Whether the game will learn text entities that have been modified during gameplay. This can improve detection on maps with VScript, but it can also increase memory usage and the size of the generated translation file (Default: 0)
mt_extended_learning 0 

Notes

- You must escape quotes with a backslash (`\`) to prevent parsing errors.

PHP Code:

    // Example 
    
"en" "Destroy \"Robert\" the puppet" 

- This plugin is incompatible with Multilingual Objectives and Multilingual Objective Beta.
- You are not expected to manually add new entries, only edit existing — if a specific text is not getting picked up, please create an issue.
However, nothing will break if you do, the section name (e.g. `edf566344eb9f2cb892e073e70c70181`) is just an MD5 hash of the original text.

Full info: https://github.com/dysphie/sm-map-translator#readme
Download: https://github.com/dysphie/sm-map-translator/releases
Source code: https://github.com/dysphie/sm-map-translator

phoenix0001 08-05-2021 13:13

Re: [NMRiH] Map Translator (v0.2.1 - 2-Aug-2021)
 
1 Attachment(s)
awesome

Found a problem
After multiple loading
Information will become misplaced

ERROR
PHP Code:

    "        "840298aa7b3cea55854ae38b4ca9582a"
        "
    
{
        
"        "en"
        "        "        "
In"
        "
the"        "bar,"
        "
zombies"        "can"
        "
bite"        "through"
        "
the"        "doors,"
        "
be"        "careful."
        "
        "        "
chi"
        "        "        "
&#22312;酒吧里"
        
"僵尸会打破门"        "小心点"
        "
    } 

correct
PHP Code:

    "840298aa7b3cea55854ae38b4ca9582a"
    
{
        
"en"        "In the bar, zombies can bite through the doors, be careful."
        "chi"        "在酒吧里 僵尸会打破门 小心点"
    




Two pieces of the same information will be saved in one map
Contains the above error message and the untranslated message


PHP Code:

    "840298aa7b3cea55854ae38b4ca9582a"
    
{
        
"en"        "In the bar, zombies can bite through the doors, be careful."
        "chi"        "In the bar, zombies can bite through the doors, be careful."
    



phoenix0001 08-07-2021 07:46

Re: [NMRiH] Map Translator (v0.2.1 - 2-Aug-2021)
 
The translated map is reloaded and sometimes the information will be duplicated and misplaced
Untranslated maps, this problem will not occur

MsDysphie 08-07-2021 11:11

Re: [NMRiH] Map Translator (v0.2.1 - 2-Aug-2021)
 
Quote:

Originally Posted by phoenix0001 (Post 2754573)
awesome

Found a problem
After multiple loading
Information will become misplaced

Thanks for the report!

This normally happens when extra quotes are added to a translation phrase without proper escaping. Escaping a character means adding \ before it.

Examples of bad phrases:
- "en" "Water deals damage"" instead of "en" "Water deals damage"
- "en" "Ported by "Merz" for NMRiH" instead of "en" "Ported by \"Merz\" for NMRiH"

These can happen due to human error, or a bug with the plugin's export function.
I've shipped a speculative fix for the latter in 0.2.2. I suggest removing the faulty phrases before upgrading.

phoenix0001 08-07-2021 12:10

Re: [NMRiH] Map Translator (v0.2.1 - 2-Aug-2021)
 
Quote:

Originally Posted by MsDysphie (Post 2754709)
Thanks for the report!

This normally happens when extra quotes are added to a translation phrase without proper escaping. Escaping a character means adding \ before it.

Examples of bad phrases:
- "en" "Water deals damage"" instead of "en" "Water deals damage"
- "en" "Ported by "Merz" for NMRiH" instead of "en" "Ported by \"Merz\" for NMRiH"

These can happen due to human error, or a bug with the plugin's export function.
I've shipped a speculative fix for the latter in 0.2.2. I suggest removing the faulty phrases before upgrading.


very good :bacon!::bacon!::bacon!::bacon!:
I will upgrade now
Then to test

phoenix0001 08-07-2021 12:36

Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
 
Deleted old files
The plugin regenerates a new file
After the translation, the problem remains unchanged.

map
https://steamcommunity.com/sharedfil...?id=2518000778

MsDysphie 08-07-2021 13:51

Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
 
Quote:

Originally Posted by phoenix0001 (Post 2754712)
Deleted old files
The plugin regenerates a new file
After the translation, the problem remains unchanged.

map
https://steamcommunity.com/sharedfil...?id=2518000778

I haven't been able to reproduce this after playing nmo_lighthouse_v2 and editing the generated file several times.

Are you sure you didn't accidentally add this extra quotation mark?

https://cdn.discordapp.com/attachmen...ew_Project.png

Could you provide me with a copy of the file with the Chinese translations before the server corrupts it?

phoenix0001 08-08-2021 03:09

Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
 
Quote:

Originally Posted by MsDysphie (Post 2754716)
I haven't been able to reproduce this after playing nmo_lighthouse_v2 and editing the generated file several times.

Are you sure you didn't accidentally add this extra quotation mark?

https://cdn.discordapp.com/attachmen...ew_Project.png

Could you provide me with a copy of the file with the Chinese translations before the server corrupts it?

I really didn't pay attention to this symbol
Everything is normal after I remove this symbol
thanks

danzhi 08-08-2021 11:27

Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
 
nmrih-map-translator.smx ([NMRiH] Map Translator): Native "StringMap.ContainsKey" was not found
:下:

MsDysphie 08-08-2021 14:50

Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
 
Quote:

Originally Posted by danzhi (Post 2754773)
nmrih-map-translator.smx ([NMRiH] Map Translator): Native "StringMap.ContainsKey" was not found
:下:

You don't meet the minimum requirements

Quote:

Originally Posted by MsDysphie (Post 2753859)
Requirements:
- Sourcemod 1.11 Build 6646 or higher



All times are GMT -4. The time now is 02:15.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.