Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   language translation (https://forums.graalonline.com/forums/showthread.php?t=134268200)

scriptless 05-12-2013 09:23 AM

language translation
 
So, I am trying to understand how to use translations on Graal. Maybe someone could help me. This is what I have so far.

folderconfig
PHP Code:

file    translations/*.po
file    translations/en/*.po
file    translations/de/*.po 

serveroptions
PHP Code:

serverlanguage=en
defaultlanguage
=en
translatedlanguages
=es 

script
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
loadtranslation("test");
  
player.chat _("hello");


The file is in translations/es/test.po

Wasn't sure how to use _(), and how to set the language file up.

Also I read, but not well documented, http://www.graal.net/index.php/Creat...slation_System

callimuc 05-12-2013 03:52 PM

does your server have reading rights to that folder (in the rights of '(npcserver)')? also the file must end with _DOMAIN.po

example for the german translation:
so create a file in levels/translations/* and call it 'graalgui_de.po' (de = german domain). use this as an example for the german translation:

PHP Code:

msgid "Hello"
msgstr "Hallo"

msgid "This is a test"
msgstr "Dies ist ein Test" 

then you can do something like
PHP Code:

temp.newText _("This is a test");
gui.text temp.newText

for people having the german language set, it will translate to 'Dies ist ein Test'. And if someone is having a language set you aren't having a translation for, it will just ignore the translation.
im not too sure if its working for stuff like the players chat, I always use it for Clientside stuff on iEra (npcs chat, the text for guis etc).

scriptless 05-12-2013 04:33 PM

Quote:

Originally Posted by callimuc (Post 1717832)
does your server have reading rights to that folder (in the rights of '(npcserver)')? also the file must end with _DOMAIN.po

example for the german translation:
so create a file in levels/translations/* and call it 'graalgui_de.po' (de = german domain). use this as an example for the german translation:

PHP Code:

msgid "Hello"
msgstr "Hallo"

msgid "This is a test"
msgstr "Dies ist ein Test" 

then you can do something like
PHP Code:

temp.newText _("This is a test");
gui.text temp.newText

for people having the german language set, it will translate to 'Dies ist ein Test'. And if someone is having a language set you aren't having a translation for, it will just ignore the translation.
im not too sure if its working for stuff like the players chat, I always use it for Clientside stuff on iEra (npcs chat, the text for guis etc).

okay, I added rights to the npc server and myself
PHP Code:

rw levels/translations/* 

Nammed the file, test_de.po.

Here is contents of that file:
Quote:

msgid "hello"
msgstr "world"
and heres the weapon:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
loadtranslation("test_de");
  
player.chat _("hello");



callimuc 05-12-2013 05:09 PM

oh, i forgot the loadtranslation. leave out the _de part. the parameter is the name before your _DOMAIN.

scriptless 05-12-2013 05:26 PM

Quote:

Originally Posted by callimuc (Post 1717835)
oh, i forgot the loadtranslation. leave out the _de part. the parameter is the name before your _DOMAIN.

thanks, got it working :)


All times are GMT +2. The time now is 06:19 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.