jDiction Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

jDiction 2.2.0 released. http://jdiction.org/downloads

Author Topic: Cobalt CCK + Jdiction  (Read 12863 times)

Xtream

  • Newbie
  • *
  • Posts: 13
    • View Profile
Cobalt CCK + Jdiction
« on: September 18, 2014, 12:58:27 pm »

Hello

I'm trying to translate Cobalt with Jdiction, but have some problem with wrong alias.

Problem is with language switcher, nottranslated alias in url to another lang.:
/ru/avtobusnye-tury/kategorija/1-strana/2-avstriy <-- This is url where i'm now
/lv/autobusu-celojumi/kategorija/1-strana/2-avstriy <-- This is url when I change language
/lv/autobusu-celojumi/kategorija/1-valsts/2-austr <-- This is url if I reenter in the same category on another language.

Is it a bug or I have something wrong in my xml?

Link to component - http://www.mintjoomla.com/joomla-components/cobalt.html
My jdiction.xml in attachment.
Logged

Harald Leithner

  • Administrator
  • Hero Member
  • *****
  • Posts: 1688
    • View Profile
Re: Cobalt CCK + Jdiction
« Reply #1 on: September 18, 2014, 02:04:29 pm »

It's not possible to translate the url with only a xml file.

Atm I have a test component that uses a jdiction.php file to translate the url, if you have php experience I can give you my current implementation with some explanation.
Logged
Joomla! 5.0 Release Manager
Vote at JED

Xtream

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Cobalt CCK + Jdiction
« Reply #2 on: September 18, 2014, 06:42:43 pm »

Yes it will be nice to see some examples, how to solve this problem.
Logged

Harald Leithner

  • Administrator
  • Hero Member
  • *****
  • Posts: 1688
    • View Profile
Re: Cobalt CCK + Jdiction
« Reply #3 on: September 18, 2014, 08:28:18 pm »

This a modified version of what I'm using at the moment.

The api is unstable so may change without notice.

the file has to be put in /components/com_yyyy/helpers/jdiction.php and the class has to be yyyyHelperjDiction.

getRoute get called in mod_jdlanguageswitcher atm, but this class is designed for a central connection between a component and jdiction.

On important limitation is at the moment that you can only translate components that don't use the alias for url matching.

In your case this should work because your url is:

/ru/avtobusnye-tury/kategorija/1-strana/2-avstriy

that means the component will use 1 and 2 for matching (hopefully)

$path is the path that would be composed by mod_jdlanguageswitcher
$input is the input variables
$query I think thats the menu query property
$menuItem is the current menu item (this will change)
$target is the language or the target menu item (this will change)

hope that helps.
Logged
Joomla! 5.0 Release Manager
Vote at JED