Локализация модуля

More
4 years 4 months ago #8600 by Самусевич Сергей
и так, столкнулся с тем, что локали перевода работают не для всех мест модуля, например:
достаточно посмотреть у них в демо компонента и модуля
вверху слева, где выведен модуль, у них на англ. весрии модуля виден русский текст, типа ЯСНО, пасмурно и т.п.

это позволит получать с сервиса описание на языке сайта, работает в мультиязычности на сайте с русским/английским/ивритом/арабским остальное не проверял, но уверен что будет. 

это все из-за того, что они в helper.php формируют запрос a api сервиса с жесткой локалью 
 $currentWeatherUrl = 'api.openweathermap.org/data/2.5/weather?...&appid=%s&mode=json&lang=ru&units=metric',

из-за этого это описание, всегда будет русским, даже если вы ставите модуль на англ. сайт или другой.

для того чтобы от этого избавить, в файле helper.php

1.удалите:
 private static
        $currentWeatherUrl = 'api.openweathermap.org/data/2.5/weather?...lang=ru&units=metric',
        $fiveDayWeatherUrl = 'api.openweathermap.org/data/2.5/forecast...lang=ru&units=metric'
    ;

2. ниже этой строчки:
private static function getWeather($params, $type='current')
    {

добавьте: 
$currentLanguage = JFactory::getLanguage();
    $localLanguage = $currentLanguage->getTag();
    $shortLanguage = substr($localLanguage,0,2);

3. замените вот это:
$url = $type=='current' ? self::$currentWeatherUrl : self::$fiveDayWeatherUrl;

на вот это:
$url = $type=='current' ? 
        'api.openweathermap.org/data/2.5/weather?...guage.'&units=metric' : 'api.openweathermap.org/data/2.5/forecast...guage.'&units=metric';

 

Please Log in to join the conversation.

More
4 years 3 months ago #8622 by JoomLine
Если возможно оформте пул реквест на гитхабе github.com/Joomline/jlweather

Please Log in to join the conversation.

Powered by Kunena Forum

Last from the forum

    • Карта сайта для компонента JoomMedia
    • Здравствуйте. Уже 2 года не могу создать карту сайта для компонента JoomMedia, который покупал: 1. В компоненте JSitemap нет такого источника данных, а сам не могу создать SQL запрос карты сайта для JoomMedia 2. В компоненте JL Sitemap нет плагина JoomMedia. Сможете помочь по любому из 2-х пунктов, могу оплатит расходы, компонент JoomMedia находится по ссылке drive.google.com/file/d/1xg4oQzcmYhJ1NGP...sw2/view?usp=sharing Компонент в работе: 4in.ru/sport.html  
    • In Component / JL Sitemap
    • чет не работает
    • You may have heard about the for a while now, but you still don't dare to visit them. It is time for you to lose your fear of these prostitute websites. Take your mobile phone, and visit it now. The escorts are local prostitutes you can access for a minimum amount.
    • In Component / Yandex Market XML
    • JL Content Fields Filter в настройках полей нет та...
    •   Здравствуйте. joomline.ru/rasshirenija/moduli/jlconten...=m4vw1l4vab486665406 отсюда с гитхаба скачал и установил на джумла версии 4.1.5 со страницы установка расширений. После установки появилась ошибка " Class "Joomla\Plugin\Jlcontentfieldsfilter\Extension\Jlcontentfieldsfilter" not found" Зашел на фтп по пути /plugins/system/ и перенес папку в /plugins сменив namespace. Дальше все по инструкции - в системе активировал плагин. В модулях включил. Захожу в созданное поле - есть стандартные вкладки, вкладки "Параметры фильтрации" нет. Что делать? >>>>>>>>>>>>>>>>>>>>> Hello. joomline.ru/rasshirenija/moduli/jlconten...=m4vw1l4vab486665406 I downloaded version 4.1.5 from GitHub and installed it on Joomla from the extension installation page. After installation, an error occurred: "Class "Joomla\Plugin\Jlcontentfieldsfilter\Extension\Jlcontentfieldsfilter" not found." I went to ftp at /plugins/system/ and moved the link to /plugins, changing the namespace. Then everything according to the instructions - the plugin was activated in the system. It is enabled in the modules. I go to the created field - there are standard tabs, but there is no "Filter parameters" tab. What should I do?  
    • In Modules Joomline / JL Content Fields Filter
© 2010- JoomLine
The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. joomline.net is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

email: This email address is being protected from spambots. You need JavaScript enabled to view it.