Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support for multilanguage sites, Internationalization (I18N)
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
I have a dropdown menu (using I18N Navigation) across the header of my website (fbforth.stewkitt.com) that has a background graphic. The website is updated to the latest GetSimple 3.3.18.1 CE and I18N 3.3.2. It works just fine with HTTP access but goes all to hell with HTTPS access. Any ideas?

...lee
Reply
(2023-06-17, 09:33:41)leestwise Wrote: I have a dropdown menu (using I18N Navigation) across the header of my website (fbforth.stewkitt.com) that has a background graphic. The website is updated to the latest GetSimple 3.3.18.1 CE and I18N 3.3.2. It works just fine with HTTP access but goes all to hell with HTTPS access. Any ideas?

...lee

You have a mixed use of http & https.
Mainly images from what I can see.
http will load anything, but https will stop un-secure elements from loading.


Attached Files Thumbnail(s)
   


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
(2023-06-17, 18:45:03)islander Wrote:
(2023-06-17, 09:33:41)leestwise Wrote: I have a dropdown menu (using I18N Navigation) across the header of my website (fbforth.stewkitt.com) that has a background graphic. The website is updated to the latest GetSimple 3.3.18.1 CE and I18N 3.3.2. It works just fine with HTTP access but goes all to hell with HTTPS access. Any ideas?

...lee

You have a mixed use of http & https.
Mainly images from what I can see.
http will load anything, but https will stop un-secure elements from loading.

Now, none of the images are referenced as http, but it still  doesn’t work.

Curiously, if I take the header style out of the style sheet (style.css), and put it in header.inc.php, the background header image is loaded. This seems like going backwards.

...lee
Reply
(2023-06-17, 09:33:41)leestwise Wrote: I have a dropdown menu (using I18N Navigation) across the header of my website (fbforth.stewkitt.com) that has a background graphic. The website is updated to the latest GetSimple 3.3.18.1 CE and I18N 3.3.2. It works just fine with HTTP access but goes all to hell with HTTPS access. Any ideas?

It turns out that my Google Chrome browser [Version 114.0.5735.134 (Official Build) (64-bit)] was the culprit. I discovered this by going to Microsoft Edge, where it worked. It also worked in a Google Chrome Incognito window. I disabled all extensions, after which it also worked. I re-enabled each extension, after each of which it continued to work. The extensions are Google Docs Offline, Kaspersky Password Manager, and Kaspersky Protection. I have no idea why disabling and re-enabling should have worked, but I’ll take it.

...lee
Reply
HTTP_ACCEPT_LANGUAGE is still a problem in V 3.3.2.

Today when I searched Google for my new project, I found in the preview (and in the Google cache):

Code:
Warning: Undefined array key "HTTP_ACCEPT_LANGUAGE" in /mydomainroot/plugins/i18n_base/frontend.class.php on line 24

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /mydomainroot/plugins/i18n_base/frontend.class.php on line 24

So it seems that Google (and who else?) does not always send a HTTP_ACCEPT_LANGUAGE header, but at least sometimes omits it, resulting in the error message above. So we cannot rely on its existance.

Line 23 of frontend.class.php tries to consider this problem in advance (before line 24), but fails:
PHP Code:
if (!defined('I18N_IGNORE_USER_LANGUAGE') || !I18N_IGNORE_USER_LANGUAGE && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { 

To me this looks like a precedence problem. The "&&" precedes over the "||".
This results in grouping the last two conditions together, instead of the first two conditions.
See also https://www.php.net/manual/en/language.o...edence.php
In order to avoid this, parentheses should be used.

So the solution might be
PHP Code:
if ((!defined('I18N_IGNORE_USER_LANGUAGE') || !I18N_IGNORE_USER_LANGUAGE) && isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { 

Please let me know what you think about this.
Best regards,
Knobbles
Reply




Users browsing this thread: 7 Guest(s)