Site Map © 2016 www.panwagen.ee
( visitors 1, robots 2 )

Rif Multilanguage Manager 4.2 New

(tested with PHP8 & Typesetter 5.3)

Multilang plugin together with custom core texts and custom plugins texts translation.

Google Translation Assistant

Huge flag collection for languages. 

Language selected GADGET for public pages (with a lot of admin changed layout options).

Admin language (public pages language and administration language can be changed separately).

And much more ...

Should be working with Typesetter 5.0.3 and Typesetter 5.1.0 (tested in Chrome and Firefox).

This plugin does not have any deeper help texts yet but it is very intuitive, I believe.

Two language, english and estonian included.

Plugin with flags is up to 4mb (zipped)

Plugin is multi-language. You can translate plugin texts if "Rif Multilanguage Manager" is installed.

English need correction. If you change language files or add some new, please send a link to the files (Contact

Features

Languages selection Admin page (link->Languages):

Select languages what you need for use.

Language list is now sortable and is displayed in codes, flags etc..
Allows selecting the language for public pages and for admin texts separately.

540 languages with flags 25x15, named by language code.
280 additional bigger flag images named by "Country Name" and sorted by its sizes in folders (sizes: 16x16, 24x24, 32x32, 48x48, 64x64, 128x128)
Public pages' language stored in session to remember the language.
Adminlang stored in user file for remembering it

Page Language GADGET settings (link->Gadget Settings) :
  • display language names;
  • display small flags
  • display C. flags (bigger flags by country name)
  • display small flags and language names 
  • display C. flags and language names
  • display country codes 
  • display language codes
  • display horizontally
  • display-align right 
  • text uppercase
  • text bold
  • text size (+/- 2px list)
  • flags bordered
  • flags spherical
  • flags oval
  • flags text to the bottom
  • flags C. flag sizes (by country names 16, 24, 32, 48, 64, 128)
  • display language list in drop-down boxes and layout is right or left side
  • show gadget title
  • show selected language also in language list (normally selected language isn't been shown)
  • hide not translated pages (do not display untranslated pages in the menu. NB! Primary language pages show all menu links. Specialpages and External links do not hide)
  • use cookies (browser remembers last selected language)
  • also show the language selection when no translation page exists NEW
  • show the gadget in front of the menu NEW
  • added CSS NEW 

PS! The Gadget has admin links if mouse hower on it (close box, if you want to select the language).

MULTILANG MANAGER PAGE (link->Administration) :
  • Show page slug and menus where it places. When clicking on it, Rename/Details options popup is opened.
  • In Menus subdivisions show also Specialpages and External Liks for translations.
  • Show subdivision for display translated pages that are not stored in any menus (only regular pages are shown).
  • Rebuild menus and Extra Content files if primary language is changed (all new primary language translation pages added to the menu and old menu pages linked as translated pages. Not strongly tested!!)
  • In Statistics box, "Pages without Translations" links are shown only on the regular pages (not Specialpages)
 
Translation options popup:
  • Languages select boxes show only languages that are available for use on your pages.
  • Not bossible select pages that is used in menus.
  • Show menus where page stored and what page is primary lang.
  • Showing flags, page Title/slug and label after it with the link to edit Rename/Details page options (popup).
  • Copy selected page from the list for translation and allows writing new PageTitle/slug and Label for it to create a new page. When pages are in different languages but you want to have the same Label for it, then change PageTitle/slug (example: Label - "John",  PageTitle/slug - "John-et")
  • Option to remove Page from the list and delete it also (if page is in any menu, it can't be removed)
  • Special pages also have texts translation language links at the bottom.
  • Specialpages PageTitle/slug, Label and new additional addToURL also can be translated.
  • External Menu links and its URL also can be translated;

 

CUSTOM TRANSLATION PAGE

Custom translation allows translating Core texts, and Plugin texts to any language that you've selected for use for your pages.
There are also some searching options.

All Core language texts are the admin texts. You can filter them to use like public page texts (there are prefiltered texts for contact form, login-box and more).

If Plugin has a page Text.php file, then its texts are also translatable.

If Plugin is rif-multilang plugin ready and has admin texts translation files inside it, these texts are also translatable.

If Plugin does not have any traslating texts, then we have only these translation options:

  • Name
  • About
  • Admin Link label (if plugin has this option)
  • Special Link label (if plugin has this option)
  • Gadget label (if plugin has this option)
  • Section Type label (if plugin has this option)

 

PS! Core inline page texts change popup dialog is replaced with rif-multilang plugin dialog to save multi lang texts.

Additionals:

MENU MANAGER:

Multiple Special pages on the menus have their own Slug and Title and new addToURL parameters (Rename/Details dialog).
NB! I made it for Simple Blog addon. This allow-add multiple category links to the menu. This is experimental. Maybe it works some other addon too (working only if addToURL fileld is not empty). 
Dialog for adding a new page to the menu has now a new tab for special page select.

Add Translation link added and shows the flags (on click translation dialog opened)
Different colors for External links and Special pages.
Translation page visibility and remove are syncing by primary language page.

SECTIONS:

Colors and grouping in File Include dialog.
Aditional parameters in File Include dialog for selecting sections that we want to include. I made it for galleries. When we edit gallery images in primary language page then we do not need to edit lang page. You can include default language page to other lang page and select gallery section only to include.
NB! If you install this plugin and want to use this feature, you must over save regular pages to put unique id for sections (include sections and wrapper sections do not have the unique id and do not allow to select!!).
There is also additional parameter field for special include. This is not working yet (future work).

If you rename section title to "private" then this section showing on the page for admins only. (Sometimes other admins need some help texts)

Planned:

  • Backup, Import, Export ... for all text translations.
  • Custom translations download page. (if someone has created a translation)
  • Add some additional (3rd) language texts for compare do making translations.
  • In multi lang Page Settings popup dialog - adding an option to replace translation page content with the selected page from the list (like copy page).
  • Do complete the Multiple Special pages (just working only if addToURL fileld is not empty).
  • Do complete the Add Params For Special Pages in include dialog.
  • Making dialog window for "Add To URL" field and in Include Dialog "Add Params for special pages" (for plugin developers).
  • Adding to Include Dialog for regular pages ... copy all sections or selected sections to the corresponding page.
  • Maybe we need some additional params for other includes in Include Dialog (Extra Content and Gadgets).
  • Do make multilang option for the text inputs and the textareas where it needed. (maybe some small popup if is clicked in the field, ex. Gallery Section - imagetitle field);
  • To add small chat box for admins and deletion button for editing so you do not wait for 15 minutes. 

 

DOWNLOAD

If you can, please donate, thaks :-)

rif-Multi_Language.zip

If you downloaded or installed this plugin from the Typesetter repository and if you need country flags 64x64 and 128x128 then download it. Unzip and add folders via ftp to rif-Multi_Language flags folder.

rif-Multi_LanguageAdditionalFlags.zip

  

Install

Download, copy folder inside zip file to your Typesetter "addon" folder in server via ftp and run install in Plugin Manager.

If the original multilanguage plugin has been installed, then message "uninstall it first!" is shown.
Existing old data must be backed up and used.
Run install again.

  • If adding the new plugin that uses [WhichPage] Hook, automatically rebuild Hook list (put it to last of the list).  
  • If adding the new plugin that uses [GetMenuArray] Hook, automatically rebuild Hook list (put to first of the list).
  • If adding the new plugin that uses [SectionTypes] Hook, automatically rebuild Hook list (put to last of the list).

Add language select gadget to template - gpOutput::Get('Gadget','Language_Select'); (just like original plugin)


If you want to translate Extracontent? We need to make some changes in the core file.
This is an automated process but if something goes wrong, do it manually.

  • GpEasy ver 4 in file include/tool/gpOutput.php
  • Typesetter ver 5 in file include/tool/Output.php
     
In function GetExtra( ...
replace line $name = str_replace(' ','_',$name); 
to 
$name = str_replace(' ', '_', gpPlugin::Filter('ExtraContentFile', array($name)));

PS! This is a new Hook. Now each laguage page own diferent extracontent file (ex. named Contact.-et in estonian page)

NB! After updating gpEasy/Typesetter, then plugin install is automatically refreshed (we need to write some lines back to core script. not strongly tested).
If some important codes have been changed in future versions on core, it might not work. Also if some html code have been changed, some translations might not work).

TEST

In the beginning I made two separate plugins. Translation plugin and Multilingual plugin. They have been in use since 2014. At the beginning of 2016, I put these two together. 2017 In September I started to create additional opportunities for him. At the beginning of December 2017, I was so far off to release the beta version for public. I have tested it on my own pages and my client sites (including installation and uninstallation). But we need more tests. It's still a beta version at the moment. It should work on Typesetter versions 4.6, 5.0 and 5.1.

If you do not have a pre-installed Multi-Language plugin created by Josh. Then there should be no danger.
In the latter case, the Joshi plugin translation pages and settings will automatically be migrated. If you have a lot of translation pages, you can make a backup of the Joshi Multi Language data directory from ftp. So later, if you decide to re-place Joshi plugin then you can upload this data directory back to its place. (I did not have problems myself and did not need this move).

Ps! I've detected some bugs, will soon fix them and download a new version. For example, the translation of Core texts does not work if they have already been translated into Typesetter (for example, Contact Form)

For plugin developers

rif-Multi Language addon custom translation ready admintexts translation class example.
Translations work olso without rif-multilang installation (if you change languge in typesetter configuration).

Download plugin example ExampleMultilagAddon.zip

////////// WRITE THIS CLASS AND FUNTIONS - make php file and put it to plugin folder (ex. TextAdmin.php):

class YourUniqueClassname_languages{
    
    ########## admin texts translation works without rif-multilang plugin ###########
    static function Translates($path){        
        global $config, $langmessage, $addonPathCode, $gpAdmin, $addon_current_id;
         
         #### If you want to use translated admin texts on your visitor pages then close the following two lines
        if( common::loggedIn() )
            return: $path;
        ##

        if(!isset($langmessage[$addon_current_id])){
                
            $langsdir = $addonPathCode."/languages/";//do not change it
            $langmessage[$addon_current_id] = array();    
            $adminlang = $config["language"];
            
            ########## check if adminlang is set (If rif-multilang plugin is installed) ##############
            $users    = gpFiles::Get('_site/users');
            if(!empty($users[$gpAdmin['username']]['adminlang'])){
                $adminlang = $users[$gpAdmin['username']]['adminlang'];            
            }
                
            ########## rif-multilang plugin (change adminlang link) ###########
            if(isset($_GET['adminlang']))
                $adminlang = $_GET['adminlang'];
            
            ########## nclude default language file ############
            $langmessage[$addon_current_id] = self::PluginLangmessages($langsdir."en.main.inc");
                
            ############ overwrite default langfile  ###########
            if(file_exists($addonPathCode."/languages/".$adminlang.".main.inc")){                    
                $addlangmessages = self::PluginLangmessages($langsdir.$adminlang.".main.inc");
                $langmessage[$addon_current_id] = self::ThreeDimArray($addlangmessages, $langmessage[$addon_current_id]);
            }
        }
        
        return $path;
    }
    
    ############# plugin langmessage file include #########
    static function PluginLangmessages($Path){
        global $addon_current_id;
        
        $langmessage = array();
        include($Path);
        
        ########### Check langmessage pluginid key if exists #########
        if(isset($langmessage[$addon_current_id]) && is_array($langmessage[$addon_current_id]))
            $langmessage = $langmessage[$addon_current_id];
        
        return $langmessage;
    }
    
    static function ThreeDimArray($addlangmessages, $langmessages){
        
        foreach($addlangmessages as $key => $val){
            if(!is_array($val))
                continue;
        
            if(!isset($langmessages[$key]))
                $langmessages[$key] = array();
            $addlangmessages[$key] = $addlangmessages[$key]+$langmessages[$key];
            
            foreach($val as $_key => $_val){
                if(!is_array($_val))
                    continue;
                if(!isset($langmessages[$key][$_key]))
                    $langmessages[$key][$_key] = array();
                $addlangmessages[$key][$_key] = $addlangmessages[$key][$_key]+$langmessages[$key][$_key];                
            }
        
        }
        return $addlangmessages+$langmessages;
    }

then add this lines to your addon.ini file:

[WhichPage]
script = 'TextAdmin.php';
method = 'YourUniqueClassname_languages::Translate'; 
LANGUAGE FILES:

Store your plugin directory in the folder, ex. languages/en.main.inc (this is default language and must be there), langcode.main.inc, and so one. (Please don't change folder name and language file names must by lancode.main.inc)
This file character encoding must be utf-8 without bom.


Inside language file:

<?php
$langmessage = array(
    'Text' => 'TextTextText',
    'Your text 2' => 'TextTextText',      //etc.

 ########## NB! addissional adminlinks translation. If multilang plugin installed, we traslate this texts by javascript.
    "--ADMIN_LINKS--" => array(
        "--Plugin_Name--" => "your plugin label (ini file Addon_Name)",
        "--Plugin_About--" => "your plugin About text (ini file About)",
        "--MoreInfoLink--" => "http://yoursite.com",    
    //  "Admin_Link:Name_name (you find it on ini file [Admin_Link:Name_name])" => "translate label text",
    //  "Special_Link:name_name (you find it on ini file [Special_Link:Name_name] )" => "translate label text",
    //  "Gadget:Name_name (you find it on ini file [Gadget:Name_name] )" => "translate label text",
                    
    ####### NB! If You have Section content plugin (you maybe want translate its label)        
    //  "SectionType:your_type" => "Your Type Label",
        
               ######... add Section types hook to ini file: ###### 
               # //    [SectionTypes]
               # //    script = 'Script.php'
               # //    method = 'Class::SectionTypes'
               #
               ######... and make function, add type 'label' and traslate it    
               # // static function SectionTypes($section_types){
               # //        global $langmessage, $addon_current_id;
               #
               # //        $typelabel = "Default label";
               # //        if(isset($langmessage[$addon_current_id]["--ADMIN_LINKS--"]['SectionType:your_type'))
               #  //            $typelabel = $langmessage[$addon_current_id]["--ADMIN_LINKS--"]['SectionType:your_type'];
               #
               #  //        $section_types['section type'] = array('label' => $typelabel, 'color'=>'default color code is optional');
               #
               # //        return $section_types;
               # // }
    
    ),    
);

your scripts show admin texts:

    global $langmessage, $addon_current_id;
    echo $langmessage[$addon_current_id][text key];

or make a function like that:

function LangMessages($key){
        global $langmessage, $addon_current_id;
         
        if(!isset($langmessage[$addon_current_id][$key]))
            return $key;
        
        return $langmessage[$addon_current_id][$key];
    }

    echo LangMessages("your admin text");
PAGE TEXTS TRANSLATIONS

You need Text.php file in your plugin folder
and  content like that:

<?php
defined('is_running') or die('Not an entry point...');
$texts = array();
$texts[] = 'your text';
$texts[] = 'your other text and so on';

and add this line to your Addon.ini file:

editable_text = 'Text.php'

your script shows and edits these texts:

gpOutput::SelectText('your text value'); //##### only text display ####
gpOutput::GetAddonText('your text value %s', $html); //#### width translation link ($html replaces some text in translation string eg. $html = common::Link('some page','%s');) ####
Global variables

PHP:

    global $ml_object;
    if(isset($ml_object->lang)){
    //### without  message(), it show variables in message box
        $ml_object->lang; //### Primary language code
        $ml_object->language; //### Primary language (array) ['language name'], ['language name in english'], ['country name'], ['country code']

        message($ml_object->ml_lang); //### Selected language code
        message($ml_object->sel_language); //### Selected language array ['language name'], ['language name in english'], ['country name'], ['country code']

        message($ml_object->langs); //### All used langs (array) langcode => ['language name'], ['language name in english'], ['country name'], ['country code']
        
        //### Flags directory pathes
        $ml_object->flags .'/'.$ml_object->ml_lang.'.png'; //### small flags by language code            
        $ml_object->flagsCN .'/64/'.$ml_object->language['country name'].'.png'; //### bigger flags by Country Name - sizes 128 64 48 32 24 16 (not all langs have Country name)
        
        //### Other configs
        message($ml_object->config); //### all configs
        message($ml_object->titles); //###
        message($ml_object->lists); //### pages by index => langcode => info        
        message($ml_object->settings); //### Gadget settings
   }

JAVASCRIPT:

    //### All used languages
        var rifmultilang_languages = {"en":{"language name":"English","language name in english":"English","country name":"United Kingdom(Great Britain)","country code":"co.uk"},"et":{"language name":"Eesti","language name in english":"Estonian","country name":"Estonia","country code":"ee"}};
    //### Primary language code
        var rifmultilang_defaultlang = 'et';
    //### Selected language code
        var rifmultilang_selectedlang = 'en';
    //### Small flags dir (flags by language code)
        var rifmultilang_flags = '/addons/rif-Multi_Language/flags/iso639';
    //## Bigger flags dir (flags by country name)
        var rifmultilang_flagsCN = '/addons/rif-Multi_Language/flags/CountryName';

PS! If you change your plugin ID and/or name in addon.ini. file, then this is not is the same plugin anymore for rif-multilang plugin.

PS! All available languages to use (now language list is array)  

'langs' => array ('et' => array ('language name' => 'Eesti', 'language name in english' => 'Estonian', 'country name' => 'Estonia','country code' => 'ee', 'en' => array( ... etc.)

Not all languages have the country name, code etc.. If you want to change or add some languages, see Languages.php file in plugin dir. Flags stored in flags folder (default flags images is named by langcode and larger country flags by "country name".