Zuletzt angesehen: » joomfish
joomfish
Quelle: www.beispiel.de/...
Autor: Nikolai Plath aka elkuku - www.DeineURL.de
The Joom!Fish project for multi lingual sites
Providing a site in more than one language is basically pretty simple as long as you have only HTML. From the moment you are using a mixure of static text and dynamic content it get's a bit tricky.
The Joom!Fish component is a generic solution that helps you to keep track of your translation process and the dynamic content which shall be translated within your site. The Joom!Fish is the new version of the component formally known as MambelFish. It integrates the whole functionallity of the older versions.
Joom!Fish and what it is
The Joom!Fish is an add-on component for Joomla! which allows you to maintain and organize your manual translated content in your Mambo database.
The key features of the fish are:
- Possibility for an unlimited amount of languages
- Possibility to MANUAL translate all dynamic content of your Joomla! installation in ONE database
- Overview of the changed contents in the Translation list
- Support for all the core and 3rd Party components/modules of Joomla!
- Free configuration for translations or fields within the database (XML content element files description)
- Frontend component for language selection
- Frontend translation
How to upgrade Joom!Fish (from MambelFIsh or older versions) The related document will give you some basic information about the migration process. Basically it is possible with the included migration tool of Joom!Fish. As ther are new tables used the risk is very low - even when the first migration fails.
For further information see the Upgrade Guide Joom!Fish for template designers & site admins
The fish is basically running within a special modus that does not affect any for the styles or anything else of your standard template. The only thing you need to do is to include the Jomm!Fish module in one of your positions.
However there are some techniques, tricks and solutions to achieve certain behavior of your site. So here is a little FAQ:
- How to install MambelFish on a Joomla! 1.0.x site?
- How to use language dependent menu items / menus & content?
- How to use language dependent images?
- How to use different templates?
- When I try to add a second translation, it overwrites the first
- Performance Tips and Tweaks
- Templates and Encoding FAQs
- Some tricks on changing title etc.
- Other Tips and tricks
- For Developers:: How to make our component to work with Joom!Fish right after the installation
The key things to remember for Joomfish are:
- Use the official Joomla database API - don't use any direct calls to mysql functions etc.
- Make sure there is a primary key or index for each table where you want a translation
- Make sure that DB SELECT statements include the primary key (even if you make no reference to the result or use it in the selection (Joomfish uses this data to find the translation!)
Some tricks on changing title, meta tags etc.
Quelle: forge.joomla.org/...
Site title, meta tags and other text/settings in the configuration.php file (+ other globals in the core ;)) can be overrided in the core language files (located in ../language/). First you should ensure that your template's index.php file have the line
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo _LANGUAGE; ?>" xml:lang="<?php echo _LANGUAGE; ?>">
- who tells browsers and search engines which language to read, t.ex. useful to get the different languages indexed by Google.
eg. The top of your index should look something like:
<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo _LANGUAGE; ?>" xml:lang="<?php echo _LANGUAGE; ?>"> <head>
Then to override site title and meta tags add to your language files:
$mosConfig_sitename = 'Your site title in other language..'; $mosConfig_MetaDesc = 'Your description in other language..'; $mosConfig_MetaKeys = 'Your meta keys in other language..';
You can also make {language}.override.php files (t.ex english.override.php) and upload them to your language folder. Nice to avoid overwriting your customizations if the core language files changes, as they will in Joomla! 1.0.12 t.ex. Then you just need to add an if query in the core language files:
if(file_exists($mosConfig_absolute_path.'/language/'.$mosConfig_lang.'.override.php')) require_once($mosConfig_absolute_path.'/language/'.$mosConfig_lang.'.override.php');
Tested and working on Joomla! 1.0.12RC and Joom!Fish 1.7
Please Note!
There can be some issues with site titles on some 3.pd. components where it's not translated.
Translation UI Second Language Help
This is a Frequently Asked Question about Joom!Fish operation. When creating a site with content in three or more languages, using Joom!Fish 1.7 and Joomla! 1.0.x, sometimes it is hard to figure out how to add the third language version of a piece of content.
The problem is that the Joom!Fish Translation UI is a bit hard to understand.
Problem
The following text, taken from a forum posting, is a typical statement of the problem.
„I want to transfer our static site into Joomla and it needs to be build in 3 languages. (Joomla 1.08 and Joom!Fish 1.07 Beta are installed) I've created an content item in the first language (Dutch). Within Components/Joom!Fish/Translation I've selected the content I've created and made an translation to the 2nd language (German). But how can I make the translation in the 3rd language (English)? When I make a change in the translation, the German translation will get overwritten.“
Step-by-step solution
- Install all your languages with the standard Joomla! language installation
- Configure all your languages in Joom!Fish → language configuration
- Go to the Joom!Fish Translations page
- In the „Content Elements“ pull-down menu, select the content element you want to translate (e.g. Contents, Module, Menu)
- In the „Languages“ pull-down menu, the default value is „All languages“. Select the specific language you want to translate into. Don't leave it set to „all languages“: see below.
Discussion
The „All Languages“ setting of the „Languages“ dropdown menu works as follows. For a given piece of content in the original language:
- if there is no translation in Joom!Fish's database, then the piece of content is listed in the „Translation“ page, with “(no translation)“ in the Languages column, a red circle (Translation does not exist) in the State column. This makes it easy to select and perform the translation into the 2nd language.
- if there is at least one translation in Joom!Fish's database for that content item, then *only* the translations that exist are listed. Translations for languages Joom!Fish knows about, but which aren't yet written, do not show up in that listing.
Change the „Languages“ dropdown menu to have a specific setting (e.g. „Deutsch“). Now, every piece of content will appear in the list, with the target language (e.g. „Deutsch“) in the Languages column, and for those items with no translation into the the language, a red circle (Translation does not exist) in the State column.
This issue is present with Joom!Fish 1.7 and Joomla! 1.0.x.
External links
- Joom!Fish forum "Site in 3 Languages" is an example of an author encountering this problem.
- Joom!Fish forum "Second translation can't be made..." is an example of an author encountering this problem.
- Joomla! forum "mutliple languages with Joom!fish" (July 19 2006) is probably an example of an author encountering this problem.
- Artifact artf5347 : Translation UI "All Languages" should show missing translations also is a feature request to prevent this problem in future Joom!Fish versions.
How to use different templates?
See JOOMFISH 1.7 Tips & tricks in the Joomla! Forums.
Taken from that post:
TIP 1 - HOW TO LOAD A CSS DEPENDING OF THE LANGUAGE FRONT-END SWITCH ?
1. Add the following tag in your template index.php file:
<link href="<?php echo $mosConfig_live_site;?>/templates/YOUR TEMPLATE NAME/css/ <?php echo $mosConfig_lang;?>.css" rel="stylesheet" type="text/css"/>
This will write CSS files, depending of the selected language: english.css, spanish.css, german.css, italian.css, portuguese.css, etc…
2. If your defaut joomla language is set to english, then leave english.css empty & place it in the /templates/YOUR TEMPLATE NAME/css/ directory. Customize the other css files according to your needs. The most natural use is to change the path to an image file:
#whatever
{
background-image: url("../images/header_german.gif"); for the german.css file
}
#whatever
{
background-image: url("../images/header_spanish.gif"); for the spanish.css file
}
Place the produced CSS files into the /templates/YOUR TEMPLATE NAME/css/ directory How to select a template based on the language front-end switch?
The most easy solution is to add the following lines in your index.php
// gets template for page $cur_template = $mainframe->getTemplate(); // add this if( $mosConfig_multilingual_support ) { $cur_template .= "-". $iso_client_lang; } else { $cur_template .= "-en"; }
Now every template would be named with his standard name plus a “-en“ or “-de“ or anything else.
How to use language dependent images?
Using language depended images referes to two different sections:
- Images within content
- Images or styles within the template
A related topic is the use of different styles or layouts in a template.
It is generally adviced to use different directories for the different language related images or styles.
Images within content
To change the images within the translated content you can use the additional image files. The translatable fields are not handled like in the standard content dialog, but you can easily copy the original values and change the name of the image in the text field.
Images or styles within the template
The easiest way to handle this issue is to make the template aware of the posiible languages. This can be handled by adding either a reference to $mosConfig_lang or $iso_client_lang to the template image code or style sheet.
Within a template this can look like:
<?php $template = 'template_css.css'; $langTemplate = 'template_' .$GLOBALS['mosConfig_lang']. '_css.css'; if( files_exists( $mosConfig_live_site .'/templates/rhuk_solarflare_ii/css/' . $langTemplate ) ) { $template = $langTemplate; } ?> <link href="<?php echo $mosConfig_live_site;?> /templates/rhuk_solarflare_ii/css/<?php echo $template;?>" rel="stylesheet" type="text/css" />
This code loads the language depended Style Sheet as long a file like template_german_css.css exists.
You can do something similar with your image tags, here it is adviced to use different directories such as:
<?php $imageDir = $mosConfig_live_site . '/templates/rhuk_solarflare_ii/images'; $langImageDir = '/' . $GLOBALS['mosConfig_lang']; if( dir_exists( $imageDir . $langImageDir ) ) { $imageDir = $imageDir . $langImageDir; } ?> <img src="<?php echo $imageDir;?>/myimage.png">
How to use language dependent menu items / menus?
The basic thing behind this issue has nothing to do with the Joom!Fish in special. However this topic is of course connected. There are some basic things you need to understand prior some solutions can be explained.
Technical / Organizational background of the Joom!Fish
The translation engine of the Joom!Fish provides an effectiv and generic way of translating everything in your database. This means on the other side that this engine does not know about logical structures or relationships within you trables.
If you show a list, e.g. of menu items, and technically you select the rows of your table. The number of rows will not be changed by the Joom!Fish. Meaning independ if there is a translation available or not all menu items you are allowed to see will be shown.
Even more, as the menu items do not have any idea of how many content items resist behind their links, there is no change for the Menu or Joom!Fish to remove menu links with a section/category that is not providing content.
If you look at the content lists it's getting more logical. If you browse a section you see a list of categories including a number of items which are available in this category. This number is generate by a select count to the content table. This select count does not provide any information the Joom!Fish could use to check if this number is valid or not as the result is just a number. So if the Joom!Fish would later show less items than the count provides it would mess up everything in your site.
So what's a solution?
The most simple solution is a „language aware menu module“.
The trick is simple but effective. If you provide your system with more than one menu (Administrator → Menu → Menu Manager) such as:
- mainmenu
- mainmenu_en
- mainmenu_fr
….
Then you could enhance your menu module in the way that it is using the language depended menu instead of the normal one. In our case the mainmenu would refer to the default site language (e.g. German). The other menu's would refer to language depended menus.
As the linking of menu's to sections, categories … results in different ItemID's you can even organize different set of templates, modules and other extentions within the language depended part's of your site.
Ok this solution is not an automatic one, but it gives you a lot of flexiblity and possibilities.
One example
We have implemented a multilingual aware mod_mainmenu for Joomla! 1.0.x. You can download it in our addons section
Controling module positions based on the language
A second example of using this technique is the control over the module positions: http://forum.joomla.org/index.php/topic,62236.msg329684.html#msg329684
Tips
Tip #1: Giving Usertype "Manager" rights to translate content in the Administrator/Backend
The official ACL system (/includes/gacl.class.php) doesn't give the Mamagers rights to the Components menu.
You need to go to this file and change the ACL rules to allow him the access to the Component menu and then add the lines like:
$this->_mos_add_acl( 'administration', 'install', 'users', 'manager', 'components', 'all' ); $this->_mos_add_acl( 'administration', 'edit', 'users', 'manager', 'components', 'com_joomfish' );
e.g. after line 163
Tip #2: Translating the date/time
If you want your Joomla! site to show a translated time and/or date when you switch languages, all you need to do is add a setLocale( <SERVER_ISO> ) into your language files.
For example, in a German language file you would add the code setLocale( 'de' );.
baustelle:joomfish - 2006/12/29 12:34

