evilpuncker 503 Posted May 2, 2015 (edited) 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 Edited May 7, 2015 by evilpuncker 1 Nebraskka reacted to this Quote Share this post Link to post Share on other sites
Haru 290 Posted May 7, 2015 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: 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. 1 evilpuncker reacted to this Quote Share this post Link to post Share on other sites
evilpuncker 503 Posted May 7, 2015 @@Haru make this optional with a setting then but lets do it! Quote Share this post Link to post Share on other sites
Nebraskka 4 Posted May 7, 2015 (edited) 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. Itis hard. And mes "Oh... ...Well. I guess you are right. It is hard."; ↓↓↓ Oh... ...Well. I guessyou are right. It ishard. 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. Edited May 7, 2015 by Nebraskka Quote Share this post Link to post Share on other sites
Haru 290 Posted May 7, 2015 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. 1 Nebraskka reacted to this Quote Share this post Link to post Share on other sites
Jguy 215 Posted May 8, 2015 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? 1 Nebraskka reacted to this Quote Share this post Link to post Share on other sites
Ai4rei 321 Posted May 8, 2015 What about: mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";↓↓↓"Oh...n...Well.nI guess you are right. It is hard." 2 evilpuncker and Nebraskka reacted to this Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted May 8, 2015 What about: mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";↓↓↓"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 1 Nebraskka reacted to this Quote Share this post Link to post Share on other sites
evilpuncker 503 Posted May 8, 2015 (edited) What about: mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";↓↓↓"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? ) Edited May 8, 2015 by evilpuncker Quote Share this post Link to post Share on other sites
Ai4rei 321 Posted May 8, 2015 (edited) (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? )I guess I could. Edit: Looking at the current trunk, I do not see support for n in *mes. Edited May 8, 2015 by Ai4rei 1 evilpuncker reacted to this Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted May 8, 2015 What about: mes "Oh...";mes "...Well.";mes "I guess you are right. It is hard.";↓↓↓ "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? ) Bypassing n in pot How it will detect the newline then.... Quote Share this post Link to post Share on other sites
evilpuncker 503 Posted May 8, 2015 @@Dastgir now you got me lol @@Ai4rei indeed but I may start translating already and testing the outcome (a pot file that doesn't have 150k+ strings lol) Quote Share this post Link to post Share on other sites
Ai4rei 321 Posted May 8, 2015 (edited) 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. Edited May 8, 2015 by Ai4rei 2 Nebraskka and evilpuncker reacted to this Quote Share this post Link to post Share on other sites
evilpuncker 503 Posted May 8, 2015 (edited) @@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 edit: nvm it worked after dropping all files into php folder lol, great work 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 Edited May 8, 2015 by evilpuncker Quote Share this post Link to post Share on other sites
Kpy! 0 Posted May 13, 2015 (edited) 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). Edited May 13, 2015 by Kpy! Quote Share this post Link to post Share on other sites
milk 8 Posted May 14, 2015 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). I like this idea. Quote Share this post Link to post Share on other sites
evilpuncker 503 Posted September 11, 2015 @@Haru any news on this? 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 Quote Share this post Link to post Share on other sites
REKT 10 Posted December 29, 2015 Any news regarding this? Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted December 29, 2015 Isn't this complete? Quote Share this post Link to post Share on other sites
evilpuncker 503 Posted December 30, 2015 Isn't this complete? no, there were no change regarding this or this or this Quote Share this post Link to post Share on other sites
Haru 290 Posted December 30, 2015 The format of 'mes' messages also needs improvements (ie merge all the lines of a sentence into the same string, be it separated by n or not). I'm personally for not separating it by n (except in the places where a line break is needed), so that the text flow will change accordingly to the font use by a (hexed) client. For mob and NPC names, we currently don't have a plan. I'm open to ideas. Announce/dispbottom, etc are all translatable, by using the _() macro. FluxCP currently doesn't have a maintainer, so I'm not sure whether it'll happen. Quote Share this post Link to post Share on other sites
evilpuncker 503 Posted June 25, 2016 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. hello any chance to have it updated in order to work with current system (that has been merged today), well, no hurries tho, but I guess they are not providing a conversion too for all npcs since there are only samples Quote Share this post Link to post Share on other sites
Ai4rei 321 Posted June 26, 2016 Just to make sure, to make it support the following? mes "Lorem ipsum dolor sit amet,\r" "consectetur adipiscing elit."↓↓↓mes "Lorem ipsum dolor sit amet, consectetur adipiscing elit." Quote Share this post Link to post Share on other sites
evilpuncker 503 Posted June 26, 2016 Just to make sure, to make it support the following? mes "Lorem ipsum dolor sit amet,\r" "consectetur adipiscing elit."↓↓↓ mes "Lorem ipsum dolor sit amet, consectetur adipiscing elit." better wait for @Haru input, by the way since you pointed it out, the early code you provided can work now I guess, can you re-paste it and I'll try to make it work again (I don't really remember how I managed to do so lol) Quote Share this post Link to post Share on other sites