YOOtheme Pro is here! The best WordPress and Joomla theme. Learn more

Avatar rudolf.balas asked

widget map direction translate - multilanguage sites - tip

Hi,

I have try this solution (maybe not corectly, but function :) (look at this and change language: www.optiger.rubstudio.cz

  1. Navigate to: media/widgetkit/widgets/map/js/map.js

Set to:
Find in the code: maps.google.com/maps/api/js?sensor=false
Add thereto: &language=xx (where xx is your language) - (for me first - english - en)
So it will read: maps.google.com/maps/api/js?sensor=false&language=en

  1. Duplicate this file (map.js), change name to map_xx.js (where xx is your language) (for me second - deutsch - de)
    So it will read: media/widgetkit/widgets/map/js/map_de.js
    Find in the code in this new file: maps.google.com/maps/api/js?sensor=false&language=en
    Add change to: &language=de - (for me second - deutsch - de)
    So it will read: maps.google.com/maps/api/js?sensor=false&language=de
    Save this file as map_de.js
    If You need another language - repeat again (new file and change code with another xx :)

  2. Navigate to: media/widgetkit/widgets/map/js/lazyloader.js

Set to:
Find in the code: WIDGETKIT_URL+"/widgets/map/js/map.js"
Change to: WIDGETKIT_URL+"/widgets/map/js/map_xx.js" (where xx is your language) - (for me - deutsch - de)
Save this file as lazyloader_de.js
If You need another language - repeat again (new file and change code with another xx :)

  1. Navigate to: media/widgetkit/widgets/map/map.php

Set to:
Find in the code (about line 85):

        // add translations  
            foreach (array('FROM_ADDRESS', 'GET_DIRECTIONS', 'FILL_IN_ADDRESS', 'ADDRESS_NOT_FOUND', 'LOCATION_NOT_FOUND') as $key) {  
                $translations[$key] = $this['system']->__($key);  
            }  

            // add javascripts  
        $this['asset']->addFile('js', 'map:js/lazyloader.js');

And change to:

        // add translations  
            foreach (array('FROM_ADDRESS', 'GET_DIRECTIONS', 'FILL_IN_ADDRESS', 'ADDRESS_NOT_FOUND', 'LOCATION_NOT_FOUND') as $key) {  
                $translations[$key] = $this['system']->__($key);  
            }  

            $lang =& JFactory::getLanguage();  
            $language = $lang->getTag();   
            switch ($language) {  

            case "cs-CZ" :  
            $this['asset']->addFile('js', 'map:js/lazyloader_cs.js');  
            break;  

            case "de-DE" :  
            $this['asset']->addFile('js', 'map:js/lazyloader_de.js');  
            break;  

            case "en-GB" :  
            $this['asset']->addFile('js', 'map:js/lazyloader_en.js');  
            break;  

            default :  
            $this['asset']->addFile('js', 'map:js/lazyloader.js');  
            break;  

            }  
            // add javascripts  
            // $this['asset']->addFile('js', 'map:js/lazyloader.js');  

That is all :)

Rudolf

P.S.

Folder structure:
media/widgetkit/widgets/map/js/dashboard.js
media/widgetkit/widgets/map/js/edit.js
media/widgetkit/widgets/map/js/lazyloader_cs.js - new for cs language
media/widgetkit/widgets/map/js/lazyloader_de.js - new for de language
media/widgetkit/widgets/map/js/lazyloader.js - old for en language
media/widgetkit/widgets/map/js/map_cs.js - new for cs language
media/widgetkit/widgets/map/js/map_de.js - new for de language
media/widgetkit/widgets/map/js/map.js - old for en language
media/widgetkit/widgets/map/layouts
media/widgetkit/widgets/map/map.php - changed code files
media/widgetkit/widgets/map/map.xml
media/widgetkit/widgets/map/styles

media/widgetkit/widgets/map/js/lazyloader.js:

        (function(){$widgetkit.lazyloaders.googlemaps=function(a,b){$widgetkit.load(WIDGETKIT_URL+"/widgets/map/js/map.js").done(function(){a.googlemaps(b)})}})(jQuery);

media/widgetkit/widgets/map/js/lazyloader_cs.js:

        (function(){$widgetkit.lazyloaders.googlemaps=function(a,b){$widgetkit.load(WIDGETKIT_URL+"/widgets/map/js/map_cs.js").done(function(){a.googlemaps(b)})}})(jQuery);

media/widgetkit/widgets/map/js/lazyloader_de.js:

        (function(){$widgetkit.lazyloaders.googlemaps=function(a,b){$widgetkit.load(WIDGETKIT_URL+"/widgets/map/js/map_de.js").done(function(){a.googlemaps(b)})}})(jQuery);

media/widgetkit/widgets/map/js/map_cs.js:

b.type="text/javascript";b.async=1;b.src=location.protocol+"//maps.google.com/maps/api/js?sensor=false&language=cs&callback=jQuery.fn.googlemaps.ready";

media/widgetkit/widgets/map/js/map_de.js:

b.type="text/javascript";b.async=1;b.src=location.protocol+"//maps.google.com/maps/api/js?sensor=false&language=de&callback=jQuery.fn.googlemaps.ready";

media/widgetkit/widgets/map/js/map.js:

b.type="text/javascript";b.async=1;b.src=location.protocol+"//maps.google.com/maps/api/js?sensor=false&language=en&callback=jQuery.fn.googlemaps.ready";

media/widgetkit/widgets/map/map.php:

        // add translations  
        foreach (array('FROM_ADDRESS', 'GET_DIRECTIONS', 'FILL_IN_ADDRESS', 'ADDRESS_NOT_FOUND', 'LOCATION_NOT_FOUND') as $key) {  
            $translations[$key] = $this['system']->__($key);  
        }  

        // add javascripts  

        $lang =& JFactory::getLanguage();  
        $language = $lang->getTag();   
        switch ($language) {  

        case "cs-CZ" :  
        $this['asset']->addFile('js', 'map:js/lazyloader_cs.js');  
        break;  

        case "de-DE" :  
        $this['asset']->addFile('js', 'map:js/lazyloader_de.js');  
        break;  

        case "en-GB" :  
        $this['asset']->addFile('js', 'map:js/lazyloader.js');  
        break;  

        default :  
        $this['asset']->addFile('js', 'map:js/lazyloader.js');  
        break;  

        }  


        // $this['asset']->addFile('js', 'map:js/lazyloader.js');  
        $this['asset']->addString('js', sprintf('$widgetkit.trans.addDic(%s);', json_encode($translations)));  
  • Joomla
  • Widgetkit
  • Balance

14 Answers

1

Avatar bob Support answered

Thanks for sharing your solution, I'm certain it will be appreciated by many :smile:

6

Avatar andreas.achatz answered

BLAME on YOOTheme .. FIX THE Bugs.. that comes over and over years and month ago.. we Pay so fix it!...
i think its Time for a blog post about YooTheme Widgetkit..

3

Avatar rudolf.balas answered

to. dr.marcus.winterberg

Hi,

Text "From adress: " and "Get directions" you can change in this file:

/administrator/components/com_widgetkit/language/en-GB/en-GB.widgetkit.ini

You should make new folder xx-XX and copy file en-GB.widgetkit.ini into this folder and change name to xx-XX.widgetkit.ini

Than translate four text line into you language.

Rudolf

P.S.

Hack is needed for: - translate description into map for your multilanguage - translate result for get-direction for multilanguage

Edited

2

Avatar predator answered

These language problems and like many other minor and major issues (like contact icons not appearing etc.) or not being able to bind dynamic content directly into the slideshow for e.g. are still unresolved bugs and problems for months and years. Instead of releasing a new layout every month, the YooTheme team should focus on resolving these issues. The support board is full of missing and buggy functions complaints. Other thrid party moduls are way ahead and it should be mandatory to implement them in Yootheme. It is really unfortunate. A lot of bling bling, but not much real usability behind them widgets.

2

Avatar kurt.dorne answered

Perhaps we can get some clarity from Yoo on this as it looks like we might simply be idiots that do not know how to use Widgetkit and start hacking fully functioning code...

I tested the multilanuage functionality of the maps widget and have to agree that it does work BUT to test it you need to change the preferences in your browser (firefox: options-content-languages) try to change the language preference order and test you map.

1

Avatar bart.jan answered

To all participants of this thread.

We have it all wrong, michael.maass (from Yoo Support with over 1500 accepted aswers) tell us here in this ticket Yoomaps is (was) Multilingual ,will Widgetkit's maps become multilingual?

I am not sure why this user did what he did. But as far as I know the Widgetkit Maps do fully support the multilanguage feature without any editing of source files required.
(this user is a reference to Rudolf and this suggestion provided in this thread)

Perhaps we can get some clarity from Yoo on this as it looks like we might simply be idiots that do not know how to use Widgetkit and start hacking fully functioning code... ;-)

In all serriousness Bob, Michael it would really help if we could put this to rest.

Simply tell us that Widgetkit maps is not Multilingual (like Yootools maps was) or tell us it is... or tell us WE can fix this bug by using hack of code that Rudolf shared with us here.

Any support and participation much appreciated!

Edited

1

Avatar jose.suarez answered

Here i found an answer, you need to go to: administrator/components/com_widgetkit/language/xx-XX download and translate to your language the language files and that's it, no need to hack anything.
I see this answer somewhere else but cant find the link to it.

1

Avatar martinahovi answered

Thank you, that was exactly what I needed for a simple German Site :-)

I created a German folder, translated the language file ... and thats it!

1

Avatar fons.van.der.beek.84 answered

Why not add a tag "DIRECTION_LANGUAGE" in xx-XX.widgetkit.ini and incorporate that in map.js, it's a fix that only takes minutes for Yootheme.....

1

Avatar eric.unterberg answered

Old, but still actual. How can i translate the "Get directions" on the map?

0

Avatar dr.marcus.winterberg answered

Rudolf, thank you for the detailed instruction.

Where have you changed "From adress: " and "Get directions"
into "Z adresy: " and "Vyhledat trasu"?

As far as I can tell, this text is not to be found in your instruction.

0

Avatar stefan.bunke answered

@yootheme team: please implement the ml feature (and other bugfixes) - i've seen questions about ml from 2012 !!!

0

Avatar b01.tom answered

@eric.unterberg

At the moment you can't. English language is hard coded in the map widget JS file maps.js. See here:

... <span style="color:#000;"><span style="color:blue;">&#8627;</span> Get directions</span> ...

Know someone who can answer? Share a link to this question via email or twitter.