1

Topic: Little question: about the hardcoded language

I'm just wondering about the hardcoded language words in the files like home.tpl.

Why is the text of contentlabel hardcoded, and contentSummary not?


<table cellpadding="0" cellspacing="0">
<tr>
<td><div class="contentLabel">Body type</div></td>
<td><div class="contentSummary">{bodytype}</div>
</td></tr>
--

2

Re: Little question: about the hardcoded language

"{bodytype}" in this case is a "tag" which gets replaced by an actual field value. A hard coded "Body type" text is the name of this field.

Developer

3

Re: Little question: about the hardcoded language

ok..

but if you've some other language then english, then the home.tpl will still show the english names in that case?.

In my case i changed all the field names to the dutch language, but i guess there are a lot who will have the same "problem". 

Is it possible to also change those values?
-> (the same way like the tags)

--

4

Re: Little question: about the hardcoded language

Yes, you can either translate them right on the page or add them to the language pack and call it from there.

Developer

5

Re: Little question: about the hardcoded language

so i guess if someone wants to do it, he would have to do something like this:

- Put the words in lang.lib.home.tpl

// labels
"bodytype" =>
"Lichaamsbouw",

"Height" =>
"Lengte",

- and then call them in home.tpl

<table cellpadding="0" cellspacing="0"><tr>
<td>{lang:"home","bodytype"}</td>
<td>{bodytype}</td>

</tr><tr>

<td>>{lang:"home","Height"}</td>
<td>{height}</td></tr>

And that for all the languages.

--

6

Re: Little question: about the hardcoded language

Exactly. However you will have to keep it organized. For example if you are editing "member_profile.tpl", you should edit the language file called "lang.lib.member.php" and then use it like this {lang:"member","some_string"}. In order to find out which language file each template uses, simply look at existing definitions in that template. If it contains something like {lang:"register","username"}, then the language file you should be editing is "lang.lib.register.php".

Developer