I have ready website built with Bitrix CMS. Now I want to add couple of other languages to the website. Where can I set the multilanguage property for the website?
It is possible. If everything is custom for you, then you need to do it by changing the program code of the site. I will describe the option when a version of a site with a different language is on the same server in one section (< domain of the main language >, < domain of the main language > / < code of another language > / - version of the site with a different language).
You need to add the settings in the administration panel:
make new languages in - “Regional settings”;
make new sites by selecting the languages created above and indicating the site section.
(this is described here https://training.bitrix24.com/support/training/course/?COURSE_ID=68&LESSON_ID=6214)
For example, the second language will be in the section of the current site as /es/.
It is necessary to change the site code:
all texts that are in the component templates (if custom) should be placed in the sections /lang/es/template.php or /lang/en/template.php (each component has such folders, or create them) or /lang/ru/template.php (depending on how many sites are created in the admin panel), in these files the words are set like this
$MESS['TITLE'] = '...';
and in the template you can output like this
<?=GetMessage("TITLE")?>;
you need to create a second version of the site in the /es/ section, you can simply create the same sections and index.php files by specifying in them, for example, for the /es/index.php file
<? require ($_SERVER["DOCUMENT_ROOT"]."/index.php");
that is, the pages in all versions of the site will be the same (the same components will be launched).
The language change depends on which site is opened from which section, bitrix sets the global variable LANGUAGE_ID in which there will be the language code of the current site (specified in the admin panel), if we are in the /es/ section, then in the LANGUAGE_ID there will be “es” (if we are in section /ru/ then LANGUAGE_ID will be “ru”). So you can check the current language in the code.
If in the admin panel, in the information blocks, data is set that is displayed on the site or where they are collected from the site, then you need to create the same data for another version of the site (just checkmarks in the setting of the information block). Or to come up with something of your own, you can make a subscript to the code of the information block of the _es type, and in the code check LANGUAGE_ID to search for the necessary information block.
An example of how to implement it in the code can be found here https://github.com/ssv32/site-asisg.ru-web, this is not an ideal implementation, but you can follow the train of thought.
(in this case, the information blocks are the same, but the elements have a list type property that determines which language the data is for, and the code is filtered by this property)
Related
I have a website which is developed in drupal cms and i am newbie for drupal. I have setup whole website on my local host, and i'm debugging like that :
* Checked calling theme function,
* Checked activate theme page.tpl.php file
* Checked module which is called on content type.
But i can't get anything which become helpful for me. So please help me thanks in advance.
Drupal is known for having a pretty steep learning curve. Don't get discouraged when you are learning it!
To find out what template files and hooks are being called for specific blocks, regions, etc. of a theme, you can use the Devel and Theme Developer Modules (Theme Developer requires the simpleHtmlDom API Module):
Devel: https://www.drupal.org/project/devel
Theme Developer: https://www.drupal.org/project/devel
simpleHtmlDom API: https://www.drupal.org/project/simplehtmldom
Be wary of the version of simpleHtmlDom you install, Theme Developer only works with 7.x-1.12.
Once you've installed and enabled these modules, you will see a checkbox in the lower-left of each page. Upon checking said checkbox, you can then click any element on the page and an "info box" will be displayed with tons of debugging information:
In the sample I've included above, you can see that this element is defined in a function called theme_links(). One function name you can use to override in your theme is: minnelli_links (in this case, the theme used in this sample is "minnelli", hence minnelli_links() would override). The available variables to the function are also listed (this is where you are likely to find some information about the Content Type that is used to populate a block).
This is a great tool for debugging Drupal themes. Give it a try.
If blocks are placed on page from back-end 2 most common options are:
Placing a block on admin Blocks page (Structure -> Blocks). Here blocks can be placed to some regions, but in block properties some exceptions can be set, i.e. placing block only on some content type, or only for some user group or similar.
Blocks can be added with Context module - check if you have it running - Structure -> Context in admin menu.
In my admin section i have a block maker.
The block is very simple, block_title, block_content.
What is the simplest way to show / determine a themes layout in the admin section so the user can position the blocks?
One idea is to use numbers so, 1 = block area one, 2 = block area two etc
A function in the front end could look like this:
function showBlocksForArea(1) {
// Return blocks Array where block_area=1
}
Rendered in the theme / template as:
echo'<div id="block_area_one">';
foreach($view->showBlocksForArea(1) as $row) {
echo '
<div class="block_wrap">
<div class="block_title">'.$row['block_title'].'</div>
<div class="block_body">'.$row['block_body'].'</div>
</div>
';
}
echo '</div>';
This is fine, accept the user doesn't know without looking at the theme where those areas are.
The Admin Section
Something like this would be perfect if i could grab just the HTML of the layout:
Is there a simpler way?
The following is an answer based on the chat that occurred here: https://chat.stackexchange.com/rooms/18020/room-for-xdaevax-and-codex
Here is my understanding of your goals:
You are creating a type of CMS application used to create websites
The websites are modular and will allow administrators to easily customize both the look and feel of their website and the content, without having extensive code knowledge
To facilitate this, you've created a system of templates, and content, that can be combined in various ways to create these themed pages. This is driven primarily by a set of PHP functions that extract the template and block data from the DB.
As new themes are created, the admin is able to "just work" without any modification because the functions can pull in any theme and it can be combined with any template.
The templates will have to have a naming structure that is generic so that CSS can be easily swapped out.
Given this information, I would suggets doing the following:
Database Schema
I would set up a database structure to something that resembles this schema I made:
The idea here is that a Template record can have any number of "slots". The DB is agnostic in terms of where the slots go on the page (this is the responsibility of the theme), but the TemplateSlots are used to provide "place holders" for where content (Blocks) can be placed.
Each time a user creates a new Page, a Page record is added and the page is associated with a Template, from which it also has information about the slots. The Template also defines a file (a PHP file most likely) that specifies place holders where the slots are placed. The Page gets the Theme information from the Site which it is associated with. Each Theme can have a set of ThemeContents (multiple CSS files, js files, images, etc....).
Blocks can be created that could have content assigned to them. These blocks are independent of a Template initially, and the DB could be pre-populated with common building 'blocks'. These blocks can be associated with a Template and assigned a TemplateSlot once a block is assigned to a Page by having a PageBlock record created.
DB Conclusion
This structure allows a great deal of flexibility and allows the Database to handle many potentially complex user scenarios. By segmenting the Template and Slots into separate tables, you can dynamically create templates of all shapes and sizes without having to make any code changes.
PHP Admin
For your admin, you can use whatever mechanism you like to pull the data out of the DB. But the user workflow would look something like this:
Log in to admin
Select Operation (a-> Create New, b-> Update Existing)
Select Page Template
Assign content blocks to template slots
Preview
Compile changes (a -> Save New Page, b-> Update Existing)
I am new to Magento. I am working on Magento 1.8 and having problem while creating multi-store-views for different language's. I have done some configuration from backend, I gpt the multiple-store-view. Its converted from English to French but its not converting to Malaysia language. my steps are as follows
Note: I am using responsive custom theme.
Go to the site: http://www.magentocommerce.com/translations and download the proper language that you are looking for.
Extract and upload the files you downloaded to your Magento’s root directory. Keep in mind it will upload files to your app folder in Magento, but unless you try with a language that you already have there, it won’t overwrite anything as it’s a new language.
Once you finish uploading, go to your Magento’s Admin.
Go to: System>Manage Stores.
Click on “Create A Store View”.
Once there comes the really important thing: Put the name you want for the “Name” field, but in your “Code” field, make sure you enter your main theme followed by a “_” (underscore) and then the name of the language you want to use. Even if you used a new template that you did or purchase it would be under a main template type (default or base). Let’s say you have a new template you purchased called “MAG0873″ and its folder resides under “default”. Also, let’s say you installed Spanish language, then you would put “default_spanish” in this field.
Save it and now go to: System>Configuration.
There, select your new Store View name from the “Current Configuration Scope” item in the top left column.
Now, go to the option: General>Locale.
After that, uncheck the option “Use Website” and make sure you change “Locale” field to the language you downloaded (be specific according to the dropdown list!).
Save it after changing it and now clean your cache and refresh your FrontEnd.
Now, few important things:
If you didn’t deactivate the original Store View a new dropdown will appear in the FrontEnd to change the language and the new Store View’s Name will appear there. Once you select it, the entire template should switch its language.
It might happen it switches language but, it also shows old/default template, well, no worries, this means you need to set up your new Store View to use the proper template according to your design set up. The next steps are specific for the persons who install templates through the System>Design option as I do (which I think is the easier and faster way).
Go to System>Design
Add a new Design.
In the “Store” field, select the new Store View you recently created.
.Now select the “Custom Design” you previously installed in your system.
Save it.
Now, your store should be using the proper design in the proper Store View (language).
Ok, now it happens that the hoe page doesn’t show exactly as you had it on the original (English) language? Well, it might be happening that the Home page is set up for an specific Store View. To fix it, just go to CMS>Pages, now click on the “Home” record (assuming you are using default settings that come with Magento) and then in its options make sure you have “Store View” field set up to “All Store Views”. Save it now.
What's mistake i have done here.
Thanks in advance
If you'd like to have a well configured multi-language Magento setup you need to follow the steps below:
Setup a separate Store View for each language (System -> Manage
Stores -> Create store view);
Apply a Locale for each Store View (System -> Configuration ->
General -> Locale Options, select Desired Store View in "Current
Configuration Scope" drop-down in left-side navigation);
Make sure that you have translated all of your CMS pages to all of
your languages. You need to create a unique CMS page for each store
view;
If you'd like to use a separate theme for each language just do it in
System–>Configuration–>General under the Design tab;
In case you need to make a different set of categories in Navigation
menu for each store view, you may control it by "Include in Navigation
Menu" category attribute (Just choose a category for edit and go to
General Information tab). Change all text attributes in Catalog Products and Categories for
each store view
The more detailed guide find here:
http://sherodesigns.com/magento-tutorial/magento-tutorial-creating-multi-language-stores/
I've got a desktop joomla site which uses the database called 'mydatabase'. However, I've created another site for mobile version in a folder in the same host. Then:
www.mysite.com is my desktop webpage.
www.mysite.com/mobile is my mobile webpage.
Both sites, mobile and desktop, are single and independent joomla instalaltions, but they use the same db.
Then when I try to configure the default template to render my contents, I`ve got to choose between mobile contents or desktop contents, but not the two.
How can I render my both templates, so both sites work and live together?
Joomla stores most of its configuration options in the database, thus your question requires some coding to handle it. But let me get one step back.
1. The Joomla approach
Joomla allows you to define which pages show which menus. You could have a simple Joomla installation with SEF turned on, where the main menu is as it is currently in the root.
Then all you need in order to have a /mobile page with a different layout is
Create a new menu (not menu item, menu type) and name it SEF or Hidden; this will not be published anywhere.
Create a menu item with alias "mobile" in that menu.
This ensures your users will be able to surf to the page /mobile and access that menu item.
Now create a menu for the mobile part of your site, add menu items and choose the default template for each, and create a module to display it. Assign it to "Show only on the selected pages" and choose the /mobile page you just created and any others contained within the menu.
Then go back to the main menu module, and configure it to "Show on all pages except", and make the same pages selection.
Now you will have two menus, one for the desktop and the other for the mobile. Aside for the template assignment, they will be identical.
2. Third party extensions
There are third party plugins which allow you to define a different template based on several parameters: country, useragent, screen size etc.
In addition to what you find on the JED, many templates (mostly commercial ones) have a feature to define a custom layout for mobile users.
Whether you handle this with a plugin or with a template is a matter of personal choice; either will work very effectively and be more appropriate than the Joomla answer I outlined above as they will help you prevent duplication. Duplication in content or menu items is costly as maintenance and testing will be harder.
I think that the way you are doing it is very different from the normal Joomla approach (which would be have a responsive template or have the index.php of the template load different subfiles depending on device), but let's assume you have your reasons.
So you have the same database which means all of the menus are the same, all of the module assignments are the same, all of the template assignments are the same and the default template style is the same.
Now, in Joomla template styles are also stored. This is a json string of pairs with various template options.
Simple case, let's assume that both the mobile and desktop template have the same options.
Now in the templates folder of the mobile site we'll have the mobile template.
Call that mytemplate.
In the desktop site you have a the desktop template. Call it mytemplate. Install it ONCE.
So these templates have the same name but because they are in two different physical sites they are in two different physical templates folders, one in the mobile site and one in the desktop.
Now we make mytemplate style-1 the default.
In the mobile site this is always going to load the mobile template while in the desktop site it will always load the desktop template.
Now say we assign mytemplate style-2 to the news menu item. Again the appropriate template is used based on the actual site it is called from.
Now the trickier thing is if you do not have identical parameters. This is likely since the settings you need will be different. In this case, what you will need to do is make sure that the parameters defined in templateDetails.xml include both sets. So if you make a new style you need to always set the parameters for both templates. This is actually going to be helpful since you won't have to configure it twice.
I can't see any menu in the EN version of my drupal site with the following settings in my menu :
When I select french all is ok but when I select english, nothing appears (I have content in both menu indeed)
In the blocks section, I see the two menus disabled.
Thanks to help me :-)
I would suggest using menu block contrib module.
This module will allow you to treat your menus as blocks.
Create 2 blocks (1 for each menu), and in block administration page you can specify the language for each block.
As there are usually several ways to reach a goal with drupal here is a proposal for a work around:
Create two menus with no language settings.
Try to put all menu items as neutral language so they show
up in both languages. (test that)
Assign the menus as blocks to the right region.
Then use the i18n module to control the language specific
display at the block level instead of the menu or menu item level. (Note you need the i18n_block module to do that which is part of the i18n module)
If you need aditional settings for the blocks see the allready mentioned menu block module.
Also make sure you check the internationalisation documentation.
I find that having two menus is always easier for multilingual websites.
I also prefer to use different views pages for different languages so I don't run into problems. That way I can add the path to the corresponding menu easily. Whenever I have tried to combine multilingual views and menus I have faced numerous problems.
In the screenshot you included I can see you have two menus.
First of all, I find it easier to name and title the menus according to their language because it's easy to get confused otherwise i.e. Main Menu English - main_menu_en.
Secondly, your french menu probably works because it's printed by your theme which is configured to render the main menu links in the specific region. To get your English menu to work you'll have to either:
a) add the required code in your theme, or
b) remove the code for the main menu in your theme and use 2 menu blocks placed in the desired region via the block admin page. In the block settings for each block you can select which language they'll be displayed for.
As the others said, you'll need: menu_block
If you need help with adding or removing the menu from your theme, please tell us which theme you are using.
There is a Seven Steps to achieve :
Step 1: Enable all modules
Content Translation (core module)
Locale (core module)
Internationalization
Variable
optional:
Language Icons
Translation Overview
Step 2: Add a language
Go to Configuration > Regional and Language > Languages
The default language is English, and you can use the “Add Language” link to add either Predefined or custom languages.
Step 3: Detection and Selection
For this tutorial I’ve chosen to use the “URL Prefix” setting. This tells Drupal to use domain.com/es for Spanish and domain.com/de for German.
Step 4: Enable Multilingual Support for content types
Either create or edit an existing Content Type and click “Publishing Options”. Here you will see the option for enabling multilingual support. Select “Enabled, with translation. This will allow you to translate a node into multiple languages.
Step 5: Create English Content
When you create your nodes, make sure you are using the correct language, not just “Language neutral”. This is important because when you create the URL alias and Menu link title it will know which menu to put the link in.
Once you’ve created your node you should see a “translate” tab. If you click this tab you’ll be able to add a translation to this node.
Note that if you have the “Translation Overview” module installed (I highly suggest it) you’ll get a nice little window that tells you which languages you’ve added, which require priority, etc.
Step 6: Created the translated content
When you create your translation give it a translated menu link title, but give it the same url alias as the original node. Because you have multilingual support installed, it won’t give you any errors for having the same URL alias (remember, it’s putting the Spanish nodes at domain.com/es and the German nodes at domain.com/de).
Step 7: Add support for multilingual menus
Go to Structure > Menus > Main Menu. Edit the menu and enable the “Translate and Localize” option. This will switch your menu items depending on what language the user has selected site-wide.
You’ll see you have both the English menu items and the Spanish items. You can order these like you wish, but know that only the Spanish links will show up when Spanish is selected as the main menu (you’ll know because the URL will say domain.com/es).
And your final product: In front end you can see it action .
Also you can use i18n_menu_navigation_links function.