Suggestion to localization thing

evilpuncker

vai se tratar garota
Messages
2,178
Points
0
Age
109
Location
bronzil
Github
EPuncker
Emulator
Client Version
2019-05-30a MAIN
Translating 147k+ entries is not funny! the current design is like this:

this script:

mes "[Airship Staff]"; mes "When you see a broadcast"; mes "announcing that we have"; mes "arrived at your destination,"; mes "please use one of the exits"; mes "located at the north and"; mes "south ends of the Airship."; next; mes "[Airship Staff]"; mes "If you happen to miss"; mes "your stop, don't worry."; mes "The Airship is constantly"; mes "en route and you'll get"; mes "another chance to arrive"; mes "to your intended destination."; close;
will generate something like 13 separated strings to translate, my proposal is to make every "npc window" (the text between the start and the close/next) just a single entry, something like this:

"[Airship Staff]"; <-- 1 entry only because it repeats
 
"When you see a broadcast
announcing that we have
arrived at your destination,
please use one of the exits
located at the north and
south ends of the Airship."; <-- 2 entry
 
"If you happen to miss
your stop, don't worry.
The Airship is constantly
en route and you'll get
another chance to arrive
to your intended destination."; <-- 3 entry
 
 
 
@@Ind @@Haru
 
link to related topic
 
Last edited by a moderator:
I personally love this idea (and I did this in the past, in custom scripts I wrote).

The only argument that there might be against this is that, by changing the scripts to that format, they might word-wrap differently than official servers. I don't think it's a real issue, but I'd like to hear the others about this.

As of commit 09dd209, we actually have source support for a nice syntax such as:

Code:
    mes "When you see a broadcast"       // Yep, no semicolon, and no plus sign between this and the next line.        " announcing that we have"       // Just close the quotes and reopen them on the next line.        " arrived at your destination,"        " please use one of the exits"   // Ah, and yes, there can be comments between the lines.        " located at the north and"        " south ends of the Airship.";      // ^ Well, this space is because otherwise there would be no space between "and<>south".
And after the script engine parses it, it's as if there was just one long string in one line (except, it looks prettier in editors, being split in multiple lines.) This also means that the translation engine sees just one string.
 
@@Haru

make this optional with a setting then
default_tongue.png
but lets do it! 
default_laugh.png


 
Translating stuff without a whole context, having only some randomized strings, is not quite intuitive for sure and making translation process harder.
 
But using whole string for all dialogs is not always possible.
I'm not trying to be feature blocker, my point is: there is stylistic text design purpose of leaving message broken on several pieces.
 

Kind of example:

mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";
↓↓↓

Oh...
...Well.
I guess you are right. It
is hard.

And

mes "Oh... ...Well. I guess you are right. It is hard.";
↓↓↓

Oh... ...Well. I guess
you are right. It is
hard.

Boths looks worse in-game than a classic way:

mes "Oh...";mes "...Well.";mes "I guess you are right.";mes "It is hard.";
↓↓↓

Oh...
...Well.
I guess you are right.
It is hard.


As you can remember, there was some style in official NPC texts.
Making every dialog appear just in single string could break this experience.

 
Last edited by a moderator:
Ah, wonderful point. Yes, I'm aware of those, and I agree. Those /shouldn't/ be merged into one line. A separate 'mes' call would still be kept where necessary -- mostly with line breaks required by the dialogue's punctuation. Translation-wise, those are separate sentences anyways, so it makes less sense for them to be in the same string.

 
T'would be nice if the Script engine would support an automatic line wrap based on x lines. Could even make it a per script config by setting an optional setting in the script start with the tabs?

 
What about:

Code:
mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";
↓↓↓
Code:
"Oh...n...Well.nI guess you are right. It is hard."
 
What about:

mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";↓↓↓
Code:
"Oh...n...Well.nI guess you are right. It is hard."
Great, that way we can remove/add lines according to the language(considering some language needs extra words to be put)@@Haru

 
What about:

mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";↓↓↓
Code:
"Oh...n...Well.nI guess you are right. It is hard."
that is awesome =0 but I suggest that the n to be omitted in pot file so we can translate the full string without the need of editing

(and by the way, since you are a programmer yourself, mind creating a simple tool to convert all npc files to this format you posted?
default_tongue.png
)

 
Last edited by a moderator:
(and by the way, since you are a programmer yourself, mind creating a simple tool to convert all npc files to this format you posted?
default_tongue.png
)
I guess I could.
Edit:

Looking at the current trunk, I do not see support for n in *mes.

 
Last edited by a moderator:
What about:

mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";↓↓↓
Code:
"Oh...n...Well.nI guess you are right. It is hard."
 that is awesome =0 but I suggest that the n to be omitted in pot file so we can translate the full string without the need of editing

(and by the way, since you are a programmer yourself, mind creating a simple tool to convert all npc files to this format you posted?
default_tongue.png
)
Bypassing n in pot
default_ohmy.png
How it will detect the newline then....

 
@@Dastgir

now you got me lol
default_tongue.png


@@Ai4rei

indeed but I may start translating already and testing the outcome (a pot file that doesn't have 150k+ strings lol)
default_tongue.png


 
Here you go, see if it works alright (did only basic testing). Requires PHP-CLI:

php collapsemes.php /path/to/npc/folderOld files are backed up as *.bak, files that need no change are not touched. You might want to use this in a separate working copy in case it screws up.

collapsemes.php:

#!/usr/bin/php<?php// =================================================================// Collapse consecutive *mes into one, v1.0.1// (c) 2015 Ai4rei/AN//// This work is licensed under a// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )// =================================================================// Down-level (PHP 4)if(!function_exists('file_put_contents')){ function file_put_contents($sFileName,$sData) { if(($hFile = fopen($sFileName,'wb'))!==false) { return fwrite($hFile,$sData) && fclose($hFile); } return false; }}// Down-level Endfunction ProcessFile($sFile){ $bSuccess = false; echo "File: {$sFile}... load"; if(($sData =@file_get_contents($sFile))!==false) { echo ' conv'; // mes ( ( var | string ) [,+] )* string; mes " $sPattern = '/((?<![a-z0-9_])mess+((??:(??:[$.]?@?|#{1,2}|')(?:[a-zA-Z0-9_]+)$?)|(??<!)"(?:.(?!(?<!)"))*.?"))s*[,+]s*)*(??<!)"(?:.(?!(?<!)"))*.?))"s*;s*mess+")/sS'; if(preg_match($sPattern,$sData)) { do { $sData = preg_replace($sPattern,'mes $2n',$sData); } while(preg_match($sPattern,$sData)); echo ' save'; if(rename($sFile,substr($sFile,0,-3).'bak') && file_put_contents($sFile,$sData)) { echo " successn"; $bSuccess = true; } else { echo " failuren"; } } else { echo " skipn"; $bSuccess = true; } } else { echo " failuren"; } return $bSuccess;}function ProcessPath($sPath){ $bSuccess = true; echo "Enter: {$sPath}n"; if(($hDir =@opendir($sPath))!==false) { while(($sFile = readdir($hDir))!==false) { if(substr($sFile,0,1)=='.') {// unix world: skip self- and parent-references and so-called hidden files continue; } $sFullPath = $sPath.'/'.$sFile; if(is_dir($sFullPath)) { if(!ProcessPath($sFullPath)) { $bSuccess = false; break; } } elseif(is_file($sFullPath) && substr(strtolower($sFile),-4)==='.txt') { if(!ProcessFile($sFullPath)) { $bSuccess = false; break; } } } closedir($hDir); } else { echo "Failed to read directory: {$sPath}n"; } echo "Leave: {$sPath}n"; return $bSuccess;}function Main($nArgc,$aArgv){ if($nArgc<2) { echo "Usage: php collapsemes.php <script path>n"; return true; } return ProcessPath($aArgv[1]);}if(isset($_SERVER['argc']) && isset($_SERVER['argv'])){ return Main($_SERVER['argc'],$_SERVER['argv']) ? 0 : 1;}die("This script must be run on command line.n");?>
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Edit:

v1.0.1: Removed a flag, added regexp overview.

 
Last edited by a moderator:
@@Ai4rei

I'm using uniformserver as webserver, wasn't able to run it properly, created a bat file to execute "php index.php C:UniServerZwwwnpc" (or even changed path to 'npc'), well, tried many things but no success at all lol, I'm too noob for this
default_tongue.png


edit: nvm it worked after dropping all files into php folder lol, great work
default_biggrin.png


now I guess we need to update generator because it is cutting at n (http://i.imgur.com/E5mdDYI.png) but at least now I got only 69k strings to translate

 
Last edited by a moderator:
What about this...

1. Convert official scripts to the following format:

mes "[Airship Staff]";mes "When you see a broadcast", "announcing that we have", "arrived at your destination,", "please use one of the exits", "located at the north and", "south ends of the Airship.";

2. Save multi-line mes commands into the pot file as a single message separated by newlines.

msgid "When you see a broadcastnannouncing that we havenarrived at your destination,nplease use one of the exitsnlocated at the north andnsouth ends of the Airship."
This preserves the official line-breaks while also giving full control to the translator about how to format the message. Importantly, it also keeps the script syntax clean and easy to read (without newline characters all over the place).

 
Last edited by a moderator:
2. Save multi-line mes commands into the pot file as a single message separated by newlines.

Code:
msgid "When you see a broadcastnannouncing that we havenarrived at your destination,nplease use one of the exitsnlocated at the north andnsouth ends of the Airship."
This preserves the official line-breaks while also giving full control to the translator about how to format the message. Importantly, it also keeps the script syntax clean and easy to read (without newline characters all over the place).
I like this idea.
 
@@Haru

any news on this?
default_tongue.png
I'm currently waiting for any change to be implemented in order to start translating anything, since it is still a pain the current way xD

 
Isn't this complete?

 
Back
Top