Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-12-2013, 09:23 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
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
Reply With Quote
  #2  
Old 05-12-2013, 03:52 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
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).
__________________
MEEP!
Reply With Quote
  #3  
Old 05-12-2013, 04:33 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by callimuc View Post
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");

Reply With Quote
  #4  
Old 05-12-2013, 05:09 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
oh, i forgot the loadtranslation. leave out the _de part. the parameter is the name before your _DOMAIN.
__________________
MEEP!
Reply With Quote
  #5  
Old 05-12-2013, 05:26 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by callimuc View Post
oh, i forgot the loadtranslation. leave out the _de part. the parameter is the name before your _DOMAIN.
thanks, got it working
Reply With Quote
Reply


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 +2. The time now is 12:58 PM.


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