View Single Post
Old 07-02-2008, 11:20 PM   #1 (permalink)
ryanmr
The Contributor
 
ryanmr's Avatar
 
Join Date: Jun 2008
Location: Twin Cities, Minnesota, USA
Posts: 27
Thanks: 2
ryanmr is on a distinguished road
Default Multilingual sites

I read Wildhoney's tutorial on Multilingual sites and completely agree that XML is much better over PHP constants or something like that.
I have a question though, about variables in phrases.
HTML Code:
<!-- english -->
<phrase id="new_messages">You have new messages.</phrase>
<!-- spanish -->
<phrase id="new_message">Usted tiene mensajes nuevos.</phrase>
Above are static phrases that don't change, we don't say how many new messages.
HTML Code:
<!-- english -->
<phrase id="how_many_new_messages">You have %1$d new messages.</phrase>
<!-- spanish -->
<phrase id="how_many_new_messages">Usted tiene %1$d nuevos mensajes.</phrase>
Above are variable messages, they will change depending on number of messages. %1$d is just a way to represent the variability of it, since I don't know how otherwise. I'm not sure if sprintf would work in all cases without some type of intermediate function to give it the variables to be allowed in the phrase.
What kind of system would you use to handle this?
ryanmr is offline  
Reply With Quote