site running on 3 languages

A place to discuss Joomla! translation matters.

Moderator: wendhausen

Locked
monlike
Joomla! Intern
Joomla! Intern
Posts: 71
Joined: Fri Jun 06, 2014 10:57 am
Location: sweden

site running on 3 languages

Post by monlike » Fri Jun 06, 2014 11:08 am

What would be the best workaround to make a joomla3.1 custom component multi language platform compatible? What I mean I have the site running on 3 languages, my component should be able to show translated items of my component

realestates

--realestate(items) - en-EN
--realestate(items) - de-DE
--realestate(items) - cn-CN
Would be a good workaround to extend my items table with a column translation which keeps the translation language code an each time the query would take this in consideration

select * item from realestets where translation = 'en-EN'
or there is a better way to do this?

User avatar
el_libre
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 162
Joined: Wed May 23, 2007 10:09 pm
Location: Barcelona
Contact:

Re: site running on 3 languages

Post by el_libre » Mon Jun 09, 2014 8:41 am

I recommend you to read the documentation you will find http://docs.joomla.org/Portal:Developers .Normally when you do a component you put some strings in the code.Then the strings has to be translated via an ini file (as all the core do).For make it "transladable" I recommend you to use some collaborate translation site like Transifex or Crowdin.

Language base is en-GB ;)
[email protected]
http://www.catmidia.cat
Catalan Translation Team / Catalan Community

saveh1112
I've been banned!
Posts: 17
Joined: Thu Sep 05, 2013 12:46 pm
Location: iran

Re: site running on 3 languages

Post by saveh1112 » Mon Jun 09, 2014 9:34 am

For your component to be multilingual you need to define languages files which are stored in the language folder in both the administrator and public side of the website. These language files are .ini files which should be defined for every language you want to include. So if you do english and dutch your files .ini files should be in:

/language/en-GB/en-GB.com_yourcom.ini

/language/nl-NL/nl-NL.com_yourcom.ini

Then every string should be passed to the translator method _() (yes that's an underscore) in the JText class like so:

JText::_("COM_YOURCOM_STRING") where COM_YOURCOM_STRING is simply a string in your component.

I recommend using short string descriptions if the string you are translating is a large block of text.

EDIT: For your specific case I would add a column translation_id to your table where the items are stored. Then create a new table with 3 (or 4) columns where the translations are stored:

id, item_id, (language), translation

In your component xml you could add an entry which generates a dropdown to define what language your item is in. If it's anything other than the default language, it should create a new entry in the translations table.

I would also suggest to take a look how Joomla! manages languages internally and also how Joomfish works!

Good resources:

http://docs.joomla.org/Embedding_transl ... e_template

http://docs.joomla.org/Specification_of_language_files

http://docs.joomla.org/Language_Guideli ... Extensions

monlike
Joomla! Intern
Joomla! Intern
Posts: 71
Joined: Fri Jun 06, 2014 10:57 am
Location: sweden

Re: site running on 3 languages

Post by monlike » Mon Jun 09, 2014 9:54 am

thank you el_libre
and thanks saveh1112 for you complete solution


Locked

Return to “Translations”