Hercules Ultimate Localization Design

Hercules Ultimate Localization Design

Hello~! - What?!

  • Servers are now able to run under any number of languages, without having any of the default files modified
  • Designed by Haruna and Ind
Translating NPCs without editing them

  • By launching map server with the --generate-translations param a .pot (.po template) file will be created with all of the servers translate-able strings (including all npc dialogue), this file can be edited in text mode or by utilising any .po editor (there are many out there; for a high range of OSes)
  • A .po file does not need to be fully translated to be used, map server will know when loading the file, and will fallback to the hardcoded string in the npc files as necessary
  • Users are able to change their language with the new @lang command, @lang controls what language users see in @commands (msg_txt stuff) as well as over npc dialogues
  • map-server.conf has a new setting called default_language where server owners may specify which language should be used as a base
  • When you have a new .po file you want map server to use, add it to db/translations.conf
Easy to Maintain

  • Since .po is a widely used format there are many tools that can help with merging for example Poedit, which easily consolidates a translated .po file with a newly generated .pot. For example when you have a translated .po and since it was created npc dialogs were added or modified all you have to do is launch map server to generate a new .pot, open your old .po in Poedit, go "Catalog -> Update from POT file" and it will insert the new translatable strings without touching your existing translations, it will also notify you of any "obsolete" strings that are in your .po file but that are no longer in use
Script Command Macro

  • Besides messages.conf, all the dialogue utilised by 'mes' and 'select' is included in the .pot automatically, this patch also introduces a mechanism for utilising strings outside of these commands, the script macro _() which can be employed just as if it were a script function, for example set .@status$,_("Available"); tells map server to export "Available" as a translate-able string when it is run with --generate-translations (when running map server normally the macro has no overhead during runtime)
Special Thanks to

  • Raizen and Roberto from Cronus, we would not have worked on this if it weren't for them
Links~!

Editing Example

attachicon.gif
TranslationSample1.png
still working in the new revision on Hercules ? cuz i try to modify my map-server and add --generate-translations and nothing happened!

@ECHO OFF
CALL serv.bat map-server.exe map-server --generate-translations


 is that correct?

 
I'm having problems with translations plugin. This is the npc:

prontera,50,50,0 script NPC_TEST PORING,{
mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
mes "Oh! you are " + strcharinfo(PC_NAME) + ", nice to meet you.";
close;
}

In the example, all the text is included on generated translations file, but the line ", nice to meet you." is not.

It seems like if the strcharinfo command ends the line (even when the conditional boy/girl is all included and reanudates the line).

#: npc/test.txt
# mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
msgctxt "NPC_TEST"
msgid "A little "
msgstr ""

#: npc/test.txt
# mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
msgctxt "NPC_TEST"
msgid "boy"
msgstr ""

#: npc/test.txt
# mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
msgctxt "NPC_TEST"
msgid "girl"
msgstr ""

#: npc/test.txt
# mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
msgctxt "NPC_TEST"
msgid ". Who are you?"
msgstr ""

#: npc/test.txt
# mes "Oh! you are " + strcharinfo(PC_NAME) + ", nice to meet you.";
msgctxt "NPC_TEST"
msgid "Oh! you are "
msgstr ""






http://imgur.com/gallery/xwuXB

I get the error message,

unknow option '--generate-translations'

Windows
That is because since commits on Jun 25, 2016 it was moved translations template generator to a plugin and it is now needed to build the plugin to use it. You can build the plugin following this instructions (based on wiki) :

1. Open folder \vcproj-14\

2. Copy and paste plugin-sample.vcxproj to duplicate it.
3. Rename file "plugin-sample.vcxproj" to "generate-translations.vcxproj"
4. Open generate-translations.vcxproj in Notepad++
5. Find this line:
    <ProjectName>plugin-sample</ProjectName>
6. Rename 'plugin-sample' to 'generate-translations'
7. Find this line:
    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">generate-translations</TargetName>
8. Rename sample to generate-translations
9. Find this line:
    <ClCompile Include="..\src\plugins\sample.c" />
10. Renae sample to generate-translations
11. Save changes and close
12. Open MSVC. Do right-clic on Solution 'Hercules-14'. Select Add -> Existing Project...
13. Select generate-translations.vcxproj in folder \vcproj-14\
14. Right-click Hercules-14, Select Build-Solution
15. Add it to /conf/plugins.conf
plugins_list: [
    /* Enable HPMHooking when plugins in use rely on Hooking */
    "HPMHooking",     // <-- Uncomment this
    //"db2sql",
    //"sample",
    //"other",
    "generate-translations", // loads generate-translations plugin
]
 
Last edited by a moderator:
I'm having problems with translations plugin. This is the npc:

prontera,50,50,0 script NPC_TEST PORING,{
mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
mes "Oh! you are " + strcharinfo(PC_NAME) + ", nice to meet you.";
close;
}

In the example, all the text is included on generated translations file, but the line ", nice to meet you." is not.

It seems like if the strcharinfo command ends the line (even when the conditional boy/girl is all included and reanudates the line).

#: npc/test.txt
# mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
msgctxt "NPC_TEST"
msgid "A little "
msgstr ""

#: npc/test.txt
# mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
msgctxt "NPC_TEST"
msgid "boy"
msgstr ""

#: npc/test.txt
# mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
msgctxt "NPC_TEST"
msgid "girl"
msgstr ""

#: npc/test.txt
# mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
msgctxt "NPC_TEST"
msgid ". Who are you?"
msgstr ""

#: npc/test.txt
# mes "Oh! you are " + strcharinfo(PC_NAME) + ", nice to meet you.";
msgctxt "NPC_TEST"
msgid "Oh! you are "
msgstr ""






http://imgur.com/gallery/xwuXB

I get the error message,

unknow option '--generate-translations'

Windows
That is because since commits on Jun 25, 2016 it was moved translations template generator to a plugin and it is now needed to build the plugin to use it. You can build the plugin following this instructions (based on wiki) :

1. Open folder \vcproj-14\

2. Copy and paste plugin-sample.vcxproj to duplicate it.
3. Rename file "plugin-sample.vcxproj" to "generate-translations.vcxproj"
4. Open generate-translations.vcxproj in Notepad++
5. Find this line:
    <ProjectName>plugin-sample</ProjectName>
6. Rename 'plugin-sample' to 'generate-translations'
7. Find this line:
    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">generate-translations</TargetName>
8. Rename sample to generate-translations
9. Find this line:
    <ClCompile Include="..\src\plugins\sample.c" />
10. Renae sample to generate-translations
11. Save changes and close
12. Open MSVC. Do right-clic on Solution 'Hercules-14'. Select Add -> Existing Project...
13. Select generate-translations.vcxproj in folder \vcproj-14\
14. Right-click Hercules-14, Select Build-Solution
15. Add it to /conf/plugins.conf
plugins_list: [
    /* Enable HPMHooking when plugins in use rely on Hooking */
    "HPMHooking",     // <-- Uncomment this
    //"db2sql",
    //"sample",
    //"other",
    "generate-translations", // loads generate-translations plugin
]
Thank you! i get sucked this error in week.

http://imgur.com/4O73d0m

Poedit not allowed new scripting format? "\r"

 
I'm having problems with translations plugin. This is the npc:

prontera,50,50,0 script NPC_TEST PORING,{
mes "A little " + (Sex == SEX_MALE ? "boy" : "girl") + ". Who are you?";
mes "Oh! you are " + strcharinfo(PC_NAME) + ", nice to meet you.";
close;
}
Code:
mesf("A little %s. Who are you?", Sex == SEX_MALE ? "boy" : "girl");
mesf("Oh! you are %s, nice to meet you.", strcharinfo(PC_NAME));
to include functions, variables, strings or whatever you need to use mesf (mes+sprintf)

you can find some examples in my recent commits

reference sprintf

 
Last edited by a moderator:
That is because since commits on Jun 25, 2016 it was moved translations template generator to a plugin and it is now needed to build the plugin to use it. You can build the plugin following this instructions (based on wiki) :

1. Open folder \vcproj-14\

2. Copy and paste plugin-sample.vcxproj to duplicate it.
3. Rename file "plugin-sample.vcxproj" to "generate-translations.vcxproj"
4. Open generate-translations.vcxproj in Notepad++
5. Find this line:
    <ProjectName>plugin-sample</ProjectName>
6. Rename 'plugin-sample' to 'generate-translations'
7. Find this line:
    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">generate-translations</TargetName>
8. Rename sample to generate-translations
9. Find this line:
    <ClCompile Include="..\src\plugins\sample.c" />
10. Renae sample to generate-translations
11. Save changes and close
12. Open MSVC. Do right-clic on Solution 'Hercules-14'. Select Add -> Existing Project...
13. Select generate-translations.vcxproj in folder \vcproj-14\
14. Right-click Hercules-14, Select Build-Solution
15. Add it to /conf/plugins.conf
plugins_list: [
    /* Enable HPMHooking when plugins in use rely on Hooking */
    "HPMHooking",     // <-- Uncomment this
    //"db2sql",
    //"sample",
    //"other",
    "generate-translations", // loads generate-translations plugin
]
Thank you! i get sucked this error in week.

http://imgur.com/4O73d0m

Poedit not allowed new scripting format? "\r"
how it work now ? I tried to do what you said, but it didn't work! can you help me ?

i need to know how generate-translations work now, how can i generate a new translate with this new plugin ? and how can i configure this plugin?

 
Last edited by a moderator:
mesf("A little %s. Who are you?", Sex == SEX_MALE ? "boy" : "girl");


This line better replace to:

if (Sex == SEX_MALE)
  mes("A little boy. Who are you?");
else
  mes("A little girl. Who are you?");
 

Because in some languages can be issue because sentence can be different depend on gender.

 
Huld doesn't support \r in mes command (tested on Hercules-68947c86d5fe3eb2686c9b3393e3db0df083bb11 version).

Example:

Script:

mes("It seems those limbs belong to that ugly octopus. That monster should be taken care of,\r"
"but it's hard for ourselves only to make it happen, hehe.");



Generated translation:

#: npc/re/instances/octopus_cave.txt
# mes("It seems those limbs belong to that ugly octopus. That monster should be taken care of,\r"
msgctxt "Starfish"
msgid "It seems those limbs belong to that ugly octopus. That monster should be taken care of,\rbut it's hard for ourselves only to make it happen, hehe."
msgstr "Parece que esas extremidades pertenecen a ese horrible pulpo. Alguien debería encargarse de ese monstruo,\rpero el hacerlo es muy difícil para nosotros solos, hehe."

Even when there is a translation, huld always shows English text.

 
Last edited by a moderator:
generate-translations is not working, please fix it,  it's work now , ty

 
Last edited by a moderator:
How do I add "announce", "map announce" so that --generate_translations draws from NPCs?

I did not understand it!

Script Command Macro

  • Besides messages.conf, all the dialogue utilised by 'mes' and 'select' is included in the .pot automatically, this patch also introduces a mechanism for utilising strings outside of these commands, the script macro _() which can be employed just as if it were a script function, for example set .@status$,_("Available"); tells map server to export "Available" as a translate-able string when it is run with --generate-translations (when running map server normally the macro has no overhead during runtime)

 
Sorry, i am noob. I dont understand how generate the .po file. I'm execute map-server with --generate-translations param and nothing .po file is created. Someone can help?

Thanks.

 
Sorry, i am noob. I dont understand how generate the .po file. I'm execute map-server with --generate-translations param and nothing .po file is created. Someone can help?

Thanks.
it's work a charm bro

 
Any idea why map-server restarts with generate-translations plugin?

Code:
[Status]: Event 'OnInit' executed with '2405' NPCs.
[Info]: Hercules, Copyright (C) 2012-2024, Hercules Dev Team and others.
[Info]: Licensed under the GNU General Public License, version 3 or later.
[Status]: Server is 'ready' and listening on port '5121'.

[Status]: Terminating...
[Status]: Cleaned up 1156 maps.
[Status]: Close Map DB Connection....
[Status]: Close Log DB Connection....
[Status]: Finished.
[Info]: Memory manager: No memory leaks found.

Map-Server has shutdown successfully.
Restarting in 15 seconds, press Ctrl+C to cancel.
 
Any idea why map-server restarts with generate-translations plugin?

[Status]: Event 'OnInit' executed with '2405' NPCs.
[Info]: Hercules, Copyright (C) 2012-2024, Hercules Dev Team and others.
[Info]: Licensed under the GNU General Public License, version 3 or later.
[Status]: Server is 'ready' and listening on port '5121'.

[Status]: Terminating...
[Status]: Cleaned up 1156 maps.
[Status]: Close Map DB Connection....
[Status]: Close Log DB Connection....
[Status]: Finished.
[Info]: Memory manager: No memory leaks found.

Map-Server has shutdown successfully.
Restarting in 15 seconds, press Ctrl+C to cancel.

[Status]: Event 'OnInit' executed with '2405' NPCs.
[Info]: Hercules, Copyright (C) 2012-2024, Hercules Dev Team and others.
[Info]: Licensed under the GNU General Public License, version 3 or later.
[Status]: Server is 'ready' and listening on port '5121'.

[Status]: Terminating...
[Status]: Cleaned up 1156 maps.
[Status]: Close Map DB Connection....
[Status]: Close Log DB Connection....
[Status]: Finished.
[Info]: Memory manager: No memory leaks found.

Map-Server has shutdown successfully.
Restarting in 15 seconds, press Ctrl+C to cancel.

You are not supposed to keep the server online with generate-translations plugin. This plugin is only meant for you to use when generating the PO files. e.g.:

./map-server --load-plugin generate-translations --generate-translations

After you run it, it will generate the translation files and shut down. After that you don't need the plugin anymore, unless you have new NPCs that you want to generate new translation files.

 
Back
Top