Adding translation for new tags not working

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
An4k1n
Posts: 3
Joined: Mon Jul 20, 2009 2:20 pm

Adding translation for new tags not working

Post by An4k1n »

Hi there,

I try to add some translation tags to change same texts and customize my installation of phpmyfaq. My way is to add an new line to /lang/language_en.php and add one line with (for example)

Code: Select all

$PMF_LANG["msgServicearea"] = "Service Area";
Then I go to the german file (/lang/language_de.php) and also add this line with the translated text. Now I go to my template(s) and add the i18n tag

Code: Select all

<h2>{msgServicearea}</h2>
My idea was that this text is now replaced by the template engine by "Service Area", but in the frontend it is still {msgServicearea} as a headline.

Do I have to start something or what do I have to do to get my new translation tags working? Looked around here, but found no answer and the documentation just explains how to translate existing entries.

Regards, Dirk

Und das ganze noch mal auf deutsch, mir egal, wie geantwortet wird:
Also mein Problem gestaltet sich so: Ich füge ein neues Tag in der entsprechenden lang-Datei ein (erst englisch, dann deutsch) und lasse es in der .tpl Datei ausgeben über z.B. {msgServicearea}. In der lanugage_en.php hab ich folgende Zeile angegeben:

Code: Select all

$PMF_LANG["msgServicearea"] = "Service Area";
in der index.tpl steht dann irgendwo:

Code: Select all

<h2>{msgServicearea}</h2>
Wenn ich das jetzt im Browser anschaue (so kenne ich das halt von php-Template-Systemen), dann sehe ich da tatsächlich
{msgServicearea}
Warum ist das so? Muss ich noch ein Script ausführen?

Danke schon mal im Vorraus, Gruß Dirk
Thorsten
Posts: 15562
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Adding translation for new tags not working

Post by Thorsten »

Hi,

the assignment of the variables is missing. Just take a look at our FAQ entry: http://faq.phpmyfaq.de/content/1/9/en/a ... ework.html

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
vberten
Posts: 3
Joined: Thu Dec 11, 2014 4:00 pm

Re: Adding translation for new tags not working

Post by vberten »

Is there anything new for this? Is it still impossible to add new tags in the translation without modifying the core ? I would need to add some items in the template that need translations. Is there any way to do that ?

Best,

V.
Thorsten
Posts: 15562
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Adding translation for new tags not working

Post by Thorsten »

Hi,

just add them in lang/language_en.php

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
vberten
Posts: 3
Joined: Thu Dec 11, 2014 4:00 pm

Re: Adding translation for new tags not working

Post by vberten »

Hi Thorsten,

Thanks for your fast answer.

Ok, so if I get you well, if a want for instance a new "about" tag :
- I add $LANG_CONF['about'] = "something" in lang/language_en.php (as well as in other languages)
- In any of my template, I can write something like "<a href='...'>{about}</a>".

Is that correct ? Because I couldn't manage to have this working this way.

I'm also wondering if this is the best way to process, because each time an update is available, it will erase my new tags.

Best,

V.
Thorsten
Posts: 15562
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Adding translation for new tags not working

Post by Thorsten »

Hi,

nope, use $PMF_LANG for translation strings, $LANG_CONF is for translating configuration items.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply