Fork me on GitHub

Page language in Zikula  Bottom

  • Please look at the question I asked about PN 0.764 here:
    http://community.zikula.org/module-Forum-viewtopic-topic-56701.htm

    I have the same same question about Zikula
  • Evidently, the

    Code

    <html lang="<!--[lang]-->">

    variable is set somewhere in the PHP code that reads it from the database, where it is set by the setting chosen in the admin interface...

    can someone please at least tell me where that PHP code resides, in which file?
  • ok, I located part of the issue in function.lang.php

    Code

    <?php
    /**
     * Zikula Application Framework
     *
     * @copyright (c) 2004, Zikula Development Team
     * @link http://www.zikula.org
     * @version $Id: function.lang.php 24342 2008-06-06 12:03:14Z markwest $
     * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
     * @package Zikula_Template_Plugins
     * @subpackage Functions
     */


    /**
     * Smarty function to get the site's language
     *
     * available parameters:
     *  - assign      if set, the language will be assigned to this variable
     *
     * Example
     * <html lang="<!--[lang]-->">
     *
     * @author   Jörg Napp
     * @since    03. Feb. 04
     * @param    array    $params     All attributes passed to this function from the template
     * @param    object   $smarty     Reference to the Smarty object
     * @return   string   the language
     */

    function smarty_function_lang($params, &$smarty)
    {
        if (!defined('_LOCALE')) {
            define('_LOCALE','en_US');
        }
        $p = strpos(_LOCALE, '.');
        $p ? $locale = substr(_LOCALE, 0, $p) : $locale = _LOCALE;
        return DataUtil::formatForDisplay($locale);
    }


    now I've to find out where the _LOCALE comes from.
  • _LOCALE comes from language/[your_lang]/core.php

    Greetings
    R
  • cool, thanks, that means that the behavior was changed in Zikula.

    as a matter of fact, the site language setting has disappeared from admin interface, so I suppose that the language now is dynamically and correctly set according to the user's language.

    I now just have to solve the issue on my PN site.
  • Quote

    as a matter of fact, the site language setting has disappeared from admin interface


    Not quite. You have to enable multilingual features in order to be able to select a different base language. Check under Admin->Settings->Internationalization ...

    Greetings
    R
  • rgasch

    Quote

    as a matter of fact, the site language setting has disappeared from admin interface


    Not quite. You have to enable multilingual features in order to be able to select a different base language. Check under Admin->Settings->Internationalization ...

    Greetings
    R


    Thanks, but is the language declaration tag automatically adjusted to fit the language the site is displayed in, or is it still frozen to show the site's default language?
  • manarak


    Quote

    language declaration tag automatically adjusted to fit the language the site is displayed in, or is it still frozen to show the site's default language?

    what language do you need?
    there are languages that already defined in zikula.

    if you need a site's active language during session there is variable $userlang this has ative language for user/viewer of site..

    uups sorry for that.... I just use this variable name..
    here it is how it works...

    in template

    Code

    <!--[pnusergetlang assign="userLang" ]-->
    <!--[if $userLang eq "deu"]-->
       <!--[pnpageaddvar name="javascript" value="javascript/jscalendar/lang/calendar-de.js" ]-->
    <!--[else]-->
       <!--[pnpageaddvar name="javascript" value="javascript/jscalendar/lang/calendar-en.js" ]-->
    <!--[/if]-->




    edited by: shoshia, Jun 16, 2009 - 08:39 AM
  • well, I'm talking about this line in the templates:

    Code

    <html lang="<!--[lang]-->">


    On my current site this seems to be static, regardless of what newlang says.

    But for search engines it is important to declare the language, and feed the proper title and site description in the set language.

    So, I got french, english and german on my site, and I want everything to adapt to the user's language, including the meta-tags, title, description, keywords, etc. and the HTML language declaration.



    edited by: manarak, Jun 15, 2009 - 10:25 PM
  • Theme caching enabled??
    you only should use the pnRender cache, Theme caching doesn't consider the nocache tags, and that lang should be non included in the cache then, right?

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Quote

    manarak

    you don't need that $lang anyway , I think.

    that $lang is different i never use it for following reasons:
    1. there are languages that dont have locales defined nor on nix/linux servers (espetially for ancient servers :) ) nor for windows one.
    2. language detection from browser settings nether worked for me.

    so in all language core files i have 'en_US', 'eng' and charset varies from language to language my case is bilingual so I have for english and Georgian both charset===UTF-8 .
    you just change charset not lang in languages/core.php file.




    Quote

    feed the proper title and site description in the set language.

    this things are not translated...
    you can define __SITENAME__ and __SITEDESCRIPTION__ in core lang files and add to templates
    pnml calls to get this things translated.

    why this thing are handwritten in code i dont get..
    there is a beautiful approach of internationalization like used in Categories.
    you have 1 category with names on several languages.
    i'd like to see this way I18n-ed icon_razz user profile data and groups icon_rolleyes
  • The lang setting is important, because it helps search engines to include the correct descriptions and titles when people are searching in specific languages.

    I'm running a site with several sub-sites (subdomains) for different countries and in several languages.

    For example, you could have

    uk.mysite.com/en
    uk.mysite.com/fr
    uk.mysite.com/de
    de.mysite.com/de
    de.mysite.com/fr

    etc.

    So, what's needed is the classic older PN multisite setup, along with dynamic languages settings.

    Otherwise, what are the odds of getting correct descriptions, keywords and everything for an german search engine indexing de.mysite.fr, if the page's language setting tells it is in english, while the content is french and the site's subject is Germany?

This list is based on users active over the last 60 minutes.