Raised This Month: $32 Target: $400
 8% 

[ANY] Map Translator (Multilingual map texts)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
MsDysphie
AlliedModders Donor
Join Date: Dec 2017
Plugin ID:
7732
Plugin Version:
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    71 
    Plugin Description:
    Allows you to translate maps via auto-generated configs
    Old 07-27-2021 , 22:11   [ANY] Map Translator (Multilingual map texts)
    Reply With Quote #1



    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
    __________________
    Discord: @dysphie
    Donations: ko-fi.com/dysphie

    Last edited by MsDysphie; 08-26-2023 at 22:22.
    MsDysphie is offline
    phoenix0001
    Senior Member
    Join Date: Apr 2010
    Location: China
    Old 08-05-2021 , 13:13   Re: [NMRiH] Map Translator (v0.2.1 - 2-Aug-2021)
    Reply With Quote #2

    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."
        

    Attached Files
    File Type: txt nmo_lighthouse_v2.txt (22.8 KB, 199 views)
    __________________
    I like this BBS sharing of spirit

    I come from China, my English is poor

    Last edited by phoenix0001; 08-07-2021 at 09:05.
    phoenix0001 is offline
    phoenix0001
    Senior Member
    Join Date: Apr 2010
    Location: China
    Old 08-07-2021 , 07:46   Re: [NMRiH] Map Translator (v0.2.1 - 2-Aug-2021)
    Reply With Quote #3

    The translated map is reloaded and sometimes the information will be duplicated and misplaced
    Untranslated maps, this problem will not occur
    __________________
    I like this BBS sharing of spirit

    I come from China, my English is poor
    phoenix0001 is offline
    MsDysphie
    AlliedModders Donor
    Join Date: Dec 2017
    Old 08-07-2021 , 11:11   Re: [NMRiH] Map Translator (v0.2.1 - 2-Aug-2021)
    Reply With Quote #4

    Quote:
    Originally Posted by phoenix0001 View Post
    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.

    Last edited by MsDysphie; 08-07-2021 at 11:46.
    MsDysphie is offline
    phoenix0001
    Senior Member
    Join Date: Apr 2010
    Location: China
    Old 08-07-2021 , 12:10   Re: [NMRiH] Map Translator (v0.2.1 - 2-Aug-2021)
    Reply With Quote #5

    Quote:
    Originally Posted by MsDysphie View Post
    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
    I will upgrade now
    Then to test
    __________________
    I like this BBS sharing of spirit

    I come from China, my English is poor
    phoenix0001 is offline
    phoenix0001
    Senior Member
    Join Date: Apr 2010
    Location: China
    Old 08-07-2021 , 12:36   Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
    Reply With Quote #6

    Deleted old files
    The plugin regenerates a new file
    After the translation, the problem remains unchanged.

    map
    https://steamcommunity.com/sharedfil...?id=2518000778
    __________________
    I like this BBS sharing of spirit

    I come from China, my English is poor
    phoenix0001 is offline
    MsDysphie
    AlliedModders Donor
    Join Date: Dec 2017
    Old 08-07-2021 , 13:51   Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
    Reply With Quote #7

    Quote:
    Originally Posted by phoenix0001 View Post
    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?



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

    Last edited by MsDysphie; 08-07-2021 at 15:40.
    MsDysphie is offline
    phoenix0001
    Senior Member
    Join Date: Apr 2010
    Location: China
    Old 08-08-2021 , 03:09   Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
    Reply With Quote #8

    Quote:
    Originally Posted by MsDysphie View Post
    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?



    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
    __________________
    I like this BBS sharing of spirit

    I come from China, my English is poor
    phoenix0001 is offline
    danzhi
    Junior Member
    Join Date: Jul 2021
    Old 08-08-2021 , 11:27   Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
    Reply With Quote #9

    nmrih-map-translator.smx ([NMRiH] Map Translator): Native "StringMap.ContainsKey" was not found
    :下:
    danzhi is offline
    MsDysphie
    AlliedModders Donor
    Join Date: Dec 2017
    Old 08-08-2021 , 14:50   Re: [NMRiH] Map Translator (v0.2.2 - 7-Aug-2021)
    Reply With Quote #10

    Quote:
    Originally Posted by danzhi View Post
    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 View Post
    Requirements:
    - Sourcemod 1.11 Build 6646 or higher

    Last edited by MsDysphie; 08-08-2021 at 14:57.
    MsDysphie is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 04:27.


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