Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support for multilanguage sites, Internationalization (I18N)
Quote:You don't want to reinvent the wheel - absolutely, everything is already done

@Riianna
You maybe surprised, but yes I fully agree with that. A good example source
where I search and find everything already done is here:
https://www.jqueryscript.net/  or here:  https://www.cssscript.com/
and of course at github.
Reply
I did not want to hijack this thread with UIKit,
sorry if I did.
Reply
Google translated to me that a person cannot make a drop-down menu, I gave him some links to themes with examples of similar menus and not all of them use Uikit.
Reply
I am also not a fan of one or the other framework. I think of it more like you Felix, and I always try to use the tools in an application specific way. I also agree with the opinion that it is better to use the "universal" tools as little as possible, and that an excessive use of these can not be really very efficient. But I am also convinced that with a careful use of CSS frameworks, they can provide really good work.
Reply
We have installed I18N Plugin and we are using it for Hierarchical Menus.

We were seeing the following Error Messages after we changed the PHP Version to 7:
Code:
[19-Feb-2021 10:33:13 Asia/Kolkata] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; I18nNavigationItem has a deprecated constructor in /home/xxxx/public_html/plugins/i18n_navigation/frontend.class.php on line 349

[19-Feb-2021 10:33:13 Asia/Kolkata] PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /home/xxxx/public_html/plugins/i18n_navigation/frontend.class.php on line 219

We are not getting any Error Messages after we did the following 2 changes to the frontend.class.php File as suggested earlier in this Thread:
1. Changed Line 219 From
Code:
'haschildren' => $showChildren ? count($children) > 0 : self::hasChildren($childurl, $show)
To
Code:
'haschildren' => $showChildren ? $children && count($children) > 0 : self::hasChildren($childurl, $show)

2. Added following empty __construct function Code to Line 350 after class I18nNavigationItem { at Line 349
Code:
public function __construct() {}

Lakshmanan
Reply
Hello mvlcek
with the menu get_i18n_navigation(return_page_slug(),0,9,I18N_SHOW_MENU) I cannot display the private pages
with the menu get_navigation(return_page_slug()) it works
how should I do to display a menu only to connected people
Reply
(2021-03-12, 19:23:45)jjancel Wrote: Hello mvlcek
with the menu get_i18n_navigation(return_page_slug(),0,9,I18N_SHOW_MENU) I cannot display the private pages
with the menu get_navigation(return_page_slug()) it works
how should I do to display a menu only to connected people

no answer  Confused
there is someone   Huh
Reply
Hello jjancel,

Mvlcek was back on the forum not so long ago. We missed the opportunity to ask him then.
His plugins are very import to the GS cms. It would be great if he would adapt his
plugins to php7,8.
Reply
(2021-03-18, 23:18:44)Felix Wrote: Hello jjancel,

Mvlcek was back on the forum not so long ago. We missed the opportunity to ask him then.
His plugins are very import to the GS cms. It would be great if he would adapt his
plugins to php7,8.

I'm not sure if I did it right, but now it works on php7 without errors. https://getsimplecms.ru/i18n.zip
Reply
Thank you
With php7.4.16
I tested https://getsimplecms.ru/i18n.zip
The plugin displays "Internationalize content based on slug / URL names. Do not update!"
but the private page menus are still not displayed
with "get_i18n_navigation(return_page_slug(),0,9,I18N_SHOW_MENU)"
with the menu get_navigation(return_page_slug()) it works
Reply
I test on Laragon and on Uniform server.
What are you guys using for testing on php7 and 8 ?
Reply
(2021-04-16, 23:57:01)jjancel Wrote: Thank you
With php7.4.16
I tested https://getsimplecms.ru/i18n.zip
The plugin displays "Internationalize content based on slug / URL names. Do not update!"
but the private page menus are still not displayed
with "get_i18n_navigation(return_page_slug(),0,9,I18N_SHOW_MENU)"
with the menu get_navigation(return_page_slug()) it works

Private pages are visible only to you.
Reply
(2021-04-24, 19:16:53)Oleg06 Wrote:
(2021-04-16, 23:57:01)jjancel Wrote: Thank you
With php7.4.16
I tested https://getsimplecms.ru/i18n.zip
The plugin displays "Internationalize content based on slug / URL names. Do not update!"
but the private page menus are still not displayed
with "get_i18n_navigation(return_page_slug(),0,9,I18N_SHOW_MENU)"
with the menu get_navigation(return_page_slug()) it works

Private pages are visible only to you.

Hello  Oleg06
well no, that's the problem:
the title never appears in the i18n_navigation menu
Reply
(2011-01-09, 06:07:56)mvlcek Wrote: Yesterday I installed GetSimple and didn't find support for multilanguage sites.
So I've created a plugin http://get-simple.info/extend/plugin/i18n/69/, which adds multilanguage support and hierarchical menus to your website.

The language is determined by the language in the user session (if previously set with the URL parameter "setlang") and the http accept language header. By using the URL parameter "lang" this can be overridden for the current request.

If you want to show the language in the URL, see here.

Installation

Copy i18n.php to your plugin directory, change the constant I18N_DEFAULT_LANGUAGE in i18n.php, and replace the following functions in your template(s):
  • get_component with get_i18n_component
  • get_navigation with get_i18n_navigation

Usage

To internationalize a page,
  • create another page with the same slug/URL and the 2-letter language code separated by a "_" (e.g. for page "index" create another one "index_it" for italian),
  • set its meta data, esp. the title and the menu text.
  • The properties "parent page", "template" and "add to menu" are ignored, the properties of the base page (without language) are used instead.

The base page (without language) is assumed to be in the language specified as I18N_DEFAULT_LANGUAGE in i18n.php.

To use the internationalized hierarchical menu,
  • ensure that the hierarchical structure of the base pages (without language) is set up correctly (property "parent page"),
  • the "add to menu" property of the relevant base pages is checked,
  • all language pages have at least the "title" property set,
  • add to your template(s) "get_i18n_navigation(return_page_slug(), minlevel, maxlevel)", e.g.
    • "get_i18n_navigation(return_page_slug(),0,0)" for your top level menu in the header, and
    • "get_i18n_navigation(return_page_slug(),1,10)" for the remaining menu levels in the sidebar menu
  • for a menu, which should only contain entries, which are available for the current language use "get_i18n_navigation(return_page_slug(),0,10,I18N_SHOW_LANGUAGE)"
  • for a site map use "get_i18n_navigation(return_page_slug(),0,10,I18N_SHOW_PAGES)" (all pages, menu texts) or "get_i18n_navigation(return_page_slug(),0,10,I18N_SHOW_TITLES)" (all pages, titles) or "get_i18n_navigation(return_page_slug(),0,10,I18N_SHOW_MENU)" (only the pages visible in the menu).

get_i18n_navigation adds the following css classes to the list items:
  • slug of the page
  • slug of the page's parent
  • "current", if the page is the current page
  • "currentpath", if the page is a parent, grandparent, etc. of the current page
  • "open", if the page has children whose menu items are currently displayed
  • "closed", if the page has children whose menu items are currently not displayed

If you want a one-level menu only, you have to make sure that all your base pages that are in the menu have "--- None ---" as parent.

Problem Solving
  • Make sure your site URL in the GetSimple admin settings is correct - otherwise language switching might not work.

If, when visiting the site (with Chrome), the languages switches back to the default language, after you have switched to another language (with parameter setlang=...)
  • make sure that you have a favicon.ico on your site. Requesting favicon.ico MUST NOT return the GetSimple not-found page!
Reply
Had a problem with activating GSCANONICAL and using a language dropdown (utilizing return_i18n_setlang_url($lang)) at the same time. The "setlang" url parameter vanished at redirecting when GSCANONICAL was set to 1.

I made a small, ugly hack in index.php to fix this for my site.

Original:
PHP Code:
if (getDef('GSCANONICAL',true)) {
 if (
$_SERVER['REQUEST_URI'] != find_url($url$parent'relative')) {
  redirect(find_url($url$parent));
 }


I replaced this with:
PHP Code:
if (getDef('GSCANONICAL',true)) {
  $psetlang = (isset($_GET['setlang']))? '?setlang='.$_GET['setlang'].'' '';
  if ($_SERVER['REQUEST_URI'] != find_url($url$parent'relative').$psetlang) {
    redirect(find_url($url$parent).$psetlang);
  }


Of course only useful when the parameter name "setlang" was not changed.

This works for me.
But I still wonder whether there might be a better solution without hacking index.php.
Reply




Users browsing this thread: 9 Guest(s)