Component Translation

General questions regarding the use of languages in Joomla! 1.5.

Moderator: General Support Moderators

Locked
User avatar
Alfred
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Fri Aug 04, 2006 11:28 am
Contact:

Component Translation

Post by Alfred » Sat Feb 09, 2008 7:10 pm

Hi,

I've created a component and am including some translations with it, I've created the language ini files, somehow however I found out that it only works if I leave the first line in this ini empty?
Is that the way it was supposed to be ?

It doesn't say anything about an empty line in the docs:
Language File Formats

Prior to Joomla! Version 1.5, site translation was handled by a single php file for each language using php constants. In version 1.5 the file format has changed to the ini file format which is much simpler. For example:

    ALIAS=translated text string

Note that the ALIAS must be in all uppercase.

In English, the alias and the text are typically the same for short words. For longer words and phrase, the alias may be a shortened key to reference the full phrase. For example:

    YES=Yes
    NO=No
    ERRORNONAME=Please enter a name
    TIPCOPYFROM=Select an existing language to copy to create the new files

All of the ini files should be encoded and saved as having UTF-8  encoding. The BOM is not required and should not be used. (BOM stand for Bit Order Marker and is a small header to indicate that the said file is using UTF-8 encoding. This can cause errors in a PHP web application and is not used or required. Some editors offer to add BOM)
So is this a bug or a feature ?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Component Translation

Post by infograf768 » Sun Feb 10, 2008 7:07 am

I do not confirm this behaviour here.
Taking off all lines before the actual strings is not an issue.
Could you attach a package with your component, to test ?
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Alfred
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Fri Aug 04, 2006 11:28 am
Contact:

Re: Component Translation

Post by Alfred » Sun Feb 10, 2008 10:35 am

I've added my component with 2 language ini files starting with empty lines because otherwise the first ALIAS would not get translated.
You do not have the required permissions to view the files attached to this post.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Component Translation

Post by infograf768 » Sun Feb 10, 2008 3:25 pm

Sorry, your component installs OK but the admin menu brings a blank page on 1.5.1.

I tested though adding a menu item with it and language works OK, that is, if the ini file is complete (no empty line at top).
missing lines in red below.
NOTFILLED=Not all fields have been filled
MESSAGESEND=The message has been sent.
FROM=From:
TO=To:
SUBJECT=Subject:
MESSAGE=Message:
COPYTOME=Send copy to own email address
SEND=Send
RESET=Reset
MYCONTACTS=My Contacts
EDITCONTACT=Contact - Edit
NEWCONTACT=Contact - New
ALFCONTACT=ALFcontact
MY FIRST COMPONENT, INSTEAD OF 'HELLO WORLD' I DECIDED TO MAKE THIS SIMPLE CONTACTFORM.=My first component, instead of 'hello world' I decided to make this simple contactform.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Alfred
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Fri Aug 04, 2006 11:28 am
Contact:

Re: Component Translation

Post by Alfred » Sun Feb 10, 2008 3:43 pm

When going to the ALFcontact component and clicking on Send without filling in any box gives you the NOTFILLED alias i.s.o. the proper translation, well at least on my site.
Leaving the first line blank and starting with the NOTFILLED alias on the 2nd line works OK.

The two missing lines aren't missing, those textlines are only used during installation and from what I understand it is still impossible to get those translated during installation.
These lines come from the installation xml file and are not aliassen used through JText, are you using something to automatically locate these strings ?

Just uninstalled my component and re-installed, no problem whatsoever on 1.5.1 in viewing the back-end.

Running PHP5 at the moment, tried running on PHP4 but that didn't make a difference in installing or translating.
Last edited by Alfred on Sun Feb 10, 2008 4:05 pm, edited 1 time in total.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Component Translation

Post by infograf768 » Sun Feb 10, 2008 5:07 pm

The two missing lines aren't missing, those textlines are only used during installation and from what I understand it is still impossible to get those translated during installation.
These lines come from the installation xml file and are not aliassen used through JText, are you using something to automatically locate these strings ?
Wrong.
they are used when you create a menu item to the component and also for the admin menu itself.
ALF Contact
[...]
My first component, instead of 'hello world' I decided to make this simple contactform.
Put debug language on:
•Untranslated strings•

ALFCONTACT jlanguage::_() [/home/xxxx/public_html/joomla15/libraries/joomla/methods.php:122]
MY FIRST COMPONENT, INSTEAD OF 'HELLO WORLD' I DECIDED TO MAKE THIS SIMPLE CONTACTFORM. jlanguage::_() [/home/xxx/public_html/joomla15/libraries/joomla/methods.php:122]
DEFAULT is also missing in back-end

I can see the component admin menu and the menu loads on 4.4.7 but not on 5.1.6
On 4.4.7 I get this Notice:
Notice: Undefined variable: lists in /home/infosgr/public_html/joomla15/administrator/components/com_alfcontact/controller.php on line 163
Also, one ini file is missing:
/administrator/language/en-GB/en-GB.com_alfcontact.menu.ini

and these strings are nowhere to be seen:
MYCONTACTS=My Contacts
EDITCONTACT=Contact - Edit
NEWCONTACT=Contact - New
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Alfred
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Fri Aug 04, 2006 11:28 am
Contact:

Re: Component Translation

Post by Alfred » Sun Feb 10, 2008 5:56 pm

The two missing lines aren't missing, those textlines are only used during installation and from what I understand it is still impossible to get those translated during installation.
These lines come from the installation xml file and are not aliassen used through JText, are you using something to automatically locate these strings ?
Wrong.
they are used when you create a menu item to the component and also for the admin menu itself.
Ok, let me rephrase that, those lines are defined in the installation xml file, there I can not replace them with a JText::_(ALIAS), so although the text is also used elsewhere as you stated I don't know where I would put that.
Put debug language on
OK, thanks, didn't know about that one
DEFAULT is also missing in back-end
DEFAULT is defined in the Joomla bse translations, so I haven't added here as well, it translates OK here. 
I can see the component admin menu and the menu loads on 4.4.7 but not on 5.1.6
On 4.4.7 I get this Notice:
Notice: Undefined variable: lists in /home/infosgr/public_html/joomla15/administrator/components/com_alfcontact/controller.php on line 163
Thanks for that, I'll have a look at that notice, 4.4.7 and 5.2.4 run OK here
Also, one ini file is missing:
/administrator/language/en-GB/en-GB.com_alfcontact.menu.ini
I keep learning new stuff, what's that one for ?
Is it really required ?
and these strings are nowhere to be seen:
MYCONTACTS=My Contacts
EDITCONTACT=Contact - Edit
NEWCONTACT=Contact - New
These strings can be found in the backend when adding new contacts.

Thanks for the feedback, I really appreciate it, being a newbie and trying to get grip on this...





[/quote]

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Component Translation

Post by infograf768 » Mon Feb 11, 2008 7:13 am

Ok, let me rephrase that, those lines are defined in the installation xml file, there I can not replace them with a JText::_(ALIAS), so although the text is also used elsewhere as you stated I don't know where I would put that.
They do NOT need JText, the name and description are automatically used as a JText

For the rest of the errors, they look as they are due to testing on 5.2.4.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Alfred
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 142
Joined: Fri Aug 04, 2006 11:28 am
Contact:

Re: Component Translation

Post by Alfred » Mon Feb 11, 2008 9:07 am

Thanks, indeed that works, haven't found that in any docs yet, but that's the beauty of these forums, you get the inside info ;-)

Just one more question, can you explain about the menu.ini file you talked about earlier?
What goes in there and where is it placed exactly ?

merci beaucoup!

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Component Translation

Post by infograf768 » Mon Feb 11, 2008 12:16 pm

Just have a look at how it is dealt with with core components.
Each of them has a menu ini.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group


Locked

Return to “Language - Joomla! 1.5”