forum.webdiplomacy.net

webDip dev coordination forum / public access todo list
It is currently Mon Sep 25, 2017 6:09 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun Apr 07, 2013 6:24 am 
Offline

Joined: Wed Jul 29, 2009 10:22 am
Posts: 841
Hi kestas,

the use of github has really improved the update-possibilities.
I merged your code with mine in about 2 hours, and I did quite a lot of changes in many different places.

Now I just need to adapt to the new translation-system so my code is translatable too...
Can you give a small overview how this works?

Oliver


Top
 Profile  
 
PostPosted: Sun Apr 07, 2013 3:02 pm 
Offline
Site Admin

Joined: Sat Jun 28, 2008 6:24 am
Posts: 892
No worried Oliver, git is a pleasure to use and github is a great extension of it..

Basically just take whatever text you want to be translatable and wrap it in l_t(). If it has a variable in the middle e.g. "Hello ".$username." how are you this fine ".$day replace it with l_t("Hello %s how are you this fine %s", $username, $day)

It's important that you only translate at the last possible moment before it hits the wire; i.e. do not translate territory names that are about to go into the database, or vote types that are about to be saved, only translate things which are just about to be output. This lets people change the translations on the fly, and not need to worry about incompatibility with the database due to translation.

There are some other functions that let people do similar substitutions on e.g. image files, so that they can translate map overlays (l_s() etc), and ones for javascript functions etc etc, but if you wrap your text in l_t() you're 99% of the way there.

edit: Another thing to note is you don't have to translate your code for it to be compatible with other translated code. A non-translatable variant will be a bit of a pain to someone who wants to use your variant on their translated site, but it will still work, and the person using your variant can still translate it the old fashioned way.


Top
 Profile  
 
PostPosted: Sun Apr 07, 2013 6:55 pm 
Offline

Joined: Sat Mar 28, 2009 7:13 am
Posts: 185
Okay, I read through locales/readme.txt and have one remaining question...

In lookup_examples.txt, it is alphabetized, but in two sections. Is there a reason for this?

If so, when adding new text to be mapped, how do I know which of the two sections to put it in?

Thanks


Top
 Profile  
 
PostPosted: Mon Apr 08, 2013 11:08 am 
Offline
Site Admin

Joined: Sat Jun 28, 2008 6:24 am
Posts: 892
Hmm, I'm not really sure why it comes in two parts Alderian, but bear in mind that is the import format, not the way the data is stored for use. You would copy and paste data like that into the admin control panel's locale import area, and it would then convert it into a PHP serialized array like the one in the Italian folder, so I wouldn't worry about the ordering of that file, it's more about the format.


Top
 Profile  
 
PostPosted: Mon Apr 08, 2013 4:49 pm 
Offline

Joined: Sat Mar 28, 2009 7:13 am
Posts: 185
Okay, thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group