MLX adds content translation and interface translation features to ActionApps. All of this is now part of ActionApps core and these pages are here mainly for documentation and historic reasons.
(or mimo's language extension)
(C) Michael Moritz mimo/at/restoel.net
Ukraine translation by Gmail Archive - http://stoodio.org/mlx-adds-content
- 05/11/2004 MLXGet Text Documentation
- for changelog see APC AA CVS on SourceForge
- 05/10/2004 -- changed the way ids get stored, optimised sql queries and since MLX is now in APC-AA CVS removed the installation stuff from this page, to upgrade without CVS have a look at MLX installation -- the hard way
- 04/10/2004 -- now moved into APC AA CVS on SourceForge
- 03/10/2004 -- apc-aa-mlx-0.2: support for simple slice.php3 calls; better admin integration (using MLX tabs)
- 29/09/2004 -- first buggy release: basic admin interface functions
Step-by-Step Example of setting up a slice for MLX
- Create a new slice based on News Template and call it MLX Control Slice.
- Delete all deleteable fields from this slice.
- Add two new fields. Call one EN, the other one FR and choose type MLX Control for them.
- Unshow all other fields apart from these two. Have a look at MLX Screenshots to see what this should look like.
- Create a new slice. This one will hold the actual content (Content Slice). It can be any kind of slice.
- In Slice Settings select the MLX Control Slice you created before. Again, MLX Screenshots are your friend.
- Check that the slice contains a lang_code....... field.
- Add a field for the MLX information. It must be of type MLX Control. It doesnt have to be visible, so in most cases you want to hide it from the user by unticking Show.
- Done! You are ready to use the multilingual content slice.
MLX adds a little menu to the Add Item / Edit Item pages. This contains something like:
Add German | Edit English (view) | Edit Dari | etc.
Clicking on Add DE takes you to the Add Item page. This is prefilled with the contents of the original item. Once you have translated this content press the Insert button. MLX takes care of storing the information that keeps the original version of the article and the German translation together.
MLX and slice.php3 -- Displaying content using MLX on a web site
From version 0.2 MLX does actually do something do the output as well. This is configurable depending on what situation you are in. Here are three scenarios:
- You have a multilingual site. Some articles are translated, others only exist in the original language. If a vistor to your site chooses a language into which only some articles are translated you want to display the untranslated ones nevertheless (an example of this is the ESF2004 website). In this case you would use slice.php3 like this: add mlx=FR to the URL if the user selected French as his/her language. E.g. index.shtml?mlx=FR&listlen=10. MLX takes care of showing translations or original items for you. It will display an alternarive article (in this example a non-French one) if it exists one. If more than one other translation exists MLX uses the order in which the languages are defined in the MLX Control Slice. So the step-by-step example above would first look for an English version. But you (or the user may chose to) can even override this behaviour: The same way you pass the user's language choice to slice.php3 you can aslo set the order in which alternatives are used. With two languages this doesnt make sense, but given you had a third translation, let's say in German, you could pass the order like this: index.shtml?mlx=FR-DE-FR This would make MLX first look for a French version of the item, then a German one, and then a French one and display the first one found.
- You only want to display articles in the language the user has chosen. Use this syntax for your calls to slice.php3: index.shtml?mlx=FR-ONLY (This is similiar to using a condition)
- You want to display all articles including other language versions. Syntax: index.shtml?mlx=ALL. (This ignores MLX information)
MLX and view.php3
MLX supports views as well. Use set[vid]=mlx-(lang code)-(lang code 1)-..-(mode)
The _#MLX_LANG Alias
When using language defaulting this is helpful. It allows to print the current desired or default language in a view. This is hopefully helpful for creating language menus, displaying messages like "currently there isnt a translation for this article, so the original version is displayed". Have a look at the demo in MLX Screenshots for how this works.
- Q: How do I MLX-alise a slice?
A: Follow the steps in the Step-by-Step example but skip creating the Content Slice (step 5). Make sure you set the MLX Control Slice as the MLX: Language Control Slice in the slice you want to MLX-alise and that you have a field of type lang_code....... in it. To MLX-alise an item you need to edit it in the Item Manager. This means you click on the headline and the press the Update button. Click on the headline again and MLX is ready.
Bugs & Limitations & TODOS
- Maybe add to fulltext view also in slice.php3
- Testing, testing, testing
- Huge thanks to Marek Tichy for discussing this and helping implementing it as I did not know anything about Action Apps? code when I started