This is a discussion on Multi Language Website within the ASP and ASP.NET Programming forums, part of the Web Development category; Multi Language Website I want to know ..how to develop multi language support website...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Multi Language Website I want to know ..how to develop multi language support website |
| Sponsored Links |
| |||
| There are three ways to implement multilingual. 1. Creating and maintaining duplicate versions of each page for each supported language as well as having the language content, where content can’t easily be edited and also this will consume more time than other methods. 2. Creating and storing the information in database and retrieves the information to the pages in different languages. These required contents should be in respective languages. 3. Content is stored in a pretty simple XML files called Resource Files. We have to create a Resource File for each supported language. When the application is compiled, the resource files are embedded into assemblies - the default resource file is embedded in the main assembly (.dll file), language-specific resource files are embedded into their own assemblies called satellite assemblies. Resource files looks like a Hashtable, they have a name and a value - the name is the same for all resource files, and the value is a language specific translation of some content. In essence, this allows us to use the System.Resources.ResourceManager class. |
| |||
| the multi language website can be developed in these three ways, they are * Dynamic Content Generation * Site Replication, and * Selective Replication METHOD 1 Dynamic Content Generation Although this method is a very complicated way of organizing your site to support different languages, it could be an option if you have only two languages, or even three to support on a fast server. It is also a good idea to use this option only if your site is not huge. In this method all the text of the site is stored in a database. Every page carries a variable (a session variable or a query string) to identify which language the site is to be displayed in. Based on that, the content is pulled out from the respective tables for the language chosen, and displayed. This method has many disadvantages. A few significant ones are: * There could be a performance degradation of the site if the amount of content of the site is huge. * Editing the site would require you to either directly edit the content in the tables, or alternatively provide an admin panel to edit the content of each page on the site! * The load on the database is too high which could lead to lower performance METHOD 2 Site Replication This is one of the most commonly used methods on the web. In this approach the main site, which is in the default language of the website, resides in the root folder of the site. This basically is how a website is when it's a single-language site. When you want a site in German you would replicate the entire site into a directory, say German. The links in the German site should refer to the corresponding pages on the German site only. Now typing www.mysite.com would give the site in the default language, but www.mysite.com/german would give the German version of the site. On every page of the site you would have a select box with language choices. All this box does is to re-direct the user to the same page that sits on the chosen language site. Do use proper tools when replicating the site. If you were to do it manually you will have to edit each other files on the site and correct the links on them to point to the pages on the language site. If you use a tool like Dreamweaver, for example, this task will be done automatically. METHOD 3 Selective Replication Of the three methods we discuss in this article, this is the most efficient one. Although difficult to set up the first time, the maintenance effort is lower than the other two methods discussed. This method is used by many major websites, including Microsoft, for multi-language support. In Selective Replication we have the main site, which has no content or images whatsoever. The various images sit in various folders marked EN, GR, ES, etc depending on the languages. All the files that go into each of these directories have the same names. So, the English logo file name will be logo.gif, and so will the logo file for the other languages too. The content (messages, javascript alerts, etc) have two places in which they can be stored. One way is to store each individual message as separate text files, or an alternative way is to make them sit in an array which is included in every ASP file and the message that needs to appear is called from the array. Each language has a separate array which resides in its directory. So the array include depends on the language that is chosen by the user. For information on how to create/use an array for this purpose, please see my article on "efficient use of arrays". This method has no stress on the database. The database is designed to hold generic information applicable for all the languages. refer:-- Multi-Language Web Site Development |
| |||
| In all the above types, we have a resource in a native language in different way right? 1.we have a duplicate copy 2.we stored the information in the DB, 3.In XML format i hope according the cuture in <%@ Page Language="C#" AutoEventWireup="true" UICulture="de" Culture="he-IL" %> we are suppose to view the details... here is my doubt.. since v have resource in native language then wat is the purpose of using this culture info..? we can even set some flag varaible to get the resource. why we are using culture.. ? is any specific reason behind that? |
| |||
| this is a big process In Browser settings there is option in View Menu...CharacterEncoding option is AVAILABLE...like that y cant give in code |
| |||
| REquiredValidator.ErrorMessage = ResourceManagerObject.getString(""); CultureInfo culture_object = new CultureInfo ("ar-EG"); System.Threading.Thread.CurrentThread.CurrentCultu re = culture_object; System.Threading.Thread.CurrentThread.CurrentUICul ture = culture_object; All the language contents are placed into XML files and there is one file representing that language By making use of CultureInfo class and CurrentCulture variable, the Resource manager localizes a page by producing run time version of the generalized page. This way, no matter what number of languages our application support, we would have to make only one web form and change the value of CurrentCulture at appropriate place If you have to support n languages, you have to develop n resource files. The naming convention is: The first part of the file name is base name. The second part specifies the culture. This is optional part. If you skip it, the resources in the resource file would be defined for default values. Example: Your page name is webapp.aspx and you have to include three additional resource files. To include US English, Egyptian Arabic and Israel Hebrew, You have to name these resource files as webapp.aspx.en-US.resx, webapp.aspx.ar-EG.resx, webapp.aspx.he-IL.resx respectively. If you skip the second part of the name, you would be assigned resources on default. For localizing a page, design a sample page whose controls are to be localized. By sample page, I mean a page whose controls are assigned different language specific values based on the CurrentCulture value of the Current thread, as we have shortly discussed. After designing the page, go to Tools and then select Generate Local Resource. LabelResource1.Text = "Your Age" To assign language specific values to the controls, copy all the generated resources and paste them giving the file a different name. The naming convention would be same as we discussed. For example, to include the same control in Arabic language, copy all the generated resources, assign the name webapp.aspx.ar.resx and translate values for the Controls. LabelResource1.Text = "?? ?? ????" Here are snapshots of two resource files. The first one contain localizable controls which have been translated in urdu language resource file. Note that all controls which are generated by the Resource generator in Visual studio have to possess a [Localizable] property. In other words, to define a culture specific control, add [localizable] property to it. After generating the resource file, if you see the code for these controls, you would see an implicit localization expression along with code of every control. For example, the code for the Label Ac€~Age' before generating resource file The meta:resourceKey is Localization expression and its value (LabelResource1 in this case) points to the base resource. Similarly, to add other resource files for different languages, just copy all the items from the main resource file and translate the values in the respective resource files. A resource file is created which would include the control values for all the controls, you have designed. This file can be seen in the App_LocalResources folder. Its structure is like a hash table. There is Name-Value pair in it. When you open this file, you would find all controls along with their values |
| |||
| Quote:
The best way for a particular site might depend on the other requirements of it. For example, I am working on a large multi-lingual Flex RIA. There is an accompanying web site and several administration back ends written in ColdFusion. The admin areas are only in English, but the information entered using the back end might be in any language that the system supports. The database structure is split - each main item in the system has a single record which stores the generic information for that item that does not change based on language - phone number or price for example - and then multiple separate records for the textual information for each item, one in each language. The idea being that if a particular language is not available for a particular item, the English version is shown instead, which is an acceptable solution for the kind of site that it is. However, the front end of the website has static information and the site owners want a large degree of control over the look of it, so those pages are static html, managed in Adobe Contribute. The main menu uses resource bundles to handle the display of navigation in the current langauage, but separate static files are created for each content page in each language (because the site owner can easily do this as he wishes with Contribute). Some ColdFusion trickery is used to find the equivalent page in another language when the user uses the switcher widget. That's the 2 minute overview - there were a lot of factors that influenced the final setup and I could go on for hours! The point being that there's dozens of ways of doing multi-language sites and which one is best will depend on the site itself, how it's going to be managed, how the data is going to be used, the audience, etc etc. |
| |||
| Quote:
i think microsoft has some tool for it .. Microsoft WEFT 3 About WEFT The Web Embedding Fonts Tool 'WEFT', lets Web authors create 'font objects' that are linked to their Web pages so that when an Internet Explorer user views the pages they'll see them displayed in the font style contained within the font object. u can get some help thru this link Microsoft WEFT 3 - bringing OpenType font embedding to the Web |
| |||
| Thank you rajesh, But this tool is used to Embedding the fonts to our web browser, i hope we can't achieve our localization throught this, since localization means we need to look over the basic Time and date ..etc of that culture, embedding the font alone not help us to create Multi Language Website, so we need to look for that... Thanks |
| |||
| How to Build a Multi-Language Dynamic Website - The Concept I am going to present you a nice and easy way to build a multi language dynamic website. Let's say that your website requires three languages: english, french and espanol. Please note that this method will work no matter of the languages number you use. I will use many graphics in this tutorial, so you can understand better the relationships between tables and how this method really works. Note: DB_DataObject layer will be used to make sql queries. If you are not familiar with it, you should first read DB_DataObject section. So let's get it started. I will create a table, in our database, called 'languages' with the following structure: ![]() And I will have the following records: ![]() As you can see in the above picture, I have three records in our database. The 'defaut_language' field shows what is the default language. Being a dynamic site, there will be an admin area too. Admin Area 1. Manage languages In this section, you should be able to insert, edit, delete language, or change the default language. I am not going to write any code for this section, since it's a simple four fields table, which I'm sure you can handle it. 2. Manage content Your website most likely will have a menu, and I will make this menu multi-language. The database schema is shown in the next picture: ![]() menu_id and languages_id are foreign keys in the menu_description table. A new menu must be inserted in all three languages (in this case). Suppose I have two menus: first page, contact us. All these menus must be entered in three languages so I'll have: ![]() Now the management of the menu and menu_description tables it's easy to develop having the necessary tables and relationships between them. Client Area (Presentation) 1. Create language files There are three languages in our case, so we must create three files, where we will define words or phrases in our languages: en.php fr.php es.php In each of this file, we need to define constants with words or phrases we will use. __________________________________________________ ________________ /in en.php file define( 'TEXT_LOGIN', 'Login' ); define( 'TEXT_CLICK_HERE', 'Click here' ); //in fr.php file define( 'TEXT_LOGIN', 'Ouverture' ); define( 'TEXT_CLICK_HERE', 'Clic ici' ); //in es.php file define( 'TEXT_LOGIN', 'Conexion' ); define( 'TEXT_CLICK_HERE', 'chasque aqui' ); __________________________________________________ ________________ 2. Retrieve languages list Often, languages are listed in the header of your website.We are going to get all the languages from their table. __________________________________________________ ________________ //create language object and get all languages $languages = DB_DataObject::factory( 'languages' ); $languages->orderBy( 'default_language DESC, language ASC'); $languages->find(); //create a_languages array, which you will use to create language links. $a_languages = array(); while( $languages->fetch() ) { $a_languages[] = array( 'lid'=>$languages->languages_id, 'language_short'=>$languages->language_short ); } __________________________________________________ ________________ 3. Set current language __________________________________________________ ________________ //Language requested, set current language if( isset( $_GET['lid'] ) && !empty( $_GET['lid'] ) ) { $current_language = DB_DataObject::factory( 'languages' ); $current_language->get( (int)$_GET['lid'] ); } //If no language is requested, load default language else { $current_language = DB_DataObject::factory( 'languages' ); $current_language->get( 'default_language', '1' ); } __________________________________________________ ________________ 4. Load language file And now that use have the language set, we must load the right language file: __________________________________________________ ________________ //Load language file include_once( $current_language->language_short . '.php' ); //If languages_id = 1 then constants defined in en.php will be loaded __________________________________________________ ________________ 5. Load menu in current language And finally menu name must be loaded according with the current language. __________________________________________________ ________________ //create menu object, menu_description object $menu_object = DB_DataObject::factory( 'menu' ); $menu_object_description = DB_DataObject::factory( 'menu_description' ); //join them $menu_object->joinAdd( $menu_object_description ); $menu_object->orderBy( 'sort_order ASC' ); $menu_object->whereAdd( 'languages_id=' . $current_language->languages_id ); $menu_object->find(); __________________________________________________ ________________ |
| |||
| hi, Only the information wat we are embed in the page's get changed in to there native language.. is it possible to change the user entered data's similarly or it depend on user gave? eg:if the person enter the feedback(in english).. how it will be in other culture? |
| |||
| Quote:
i think u didnt catch the think properly, the post which i put b4 ll full fill ur requirement.. just check it out... |
| |||
| hi rajesh, can u explain how it is possible? /in en.php file define( 'TEXT_LOGIN', 'Login' ); define( 'TEXT_CLICK_HERE', 'Click here' ); //in fr.php file define( 'TEXT_LOGIN', 'Ouverture' ); define( 'TEXT_CLICK_HERE', 'Clic ici' ); //in es.php file define( 'TEXT_LOGIN', 'Conexion' ); define( 'TEXT_CLICK_HERE', 'chasque aqui' ); this file we are creating with the required pharse which we are going to use in our site, so it will work.. instead of login it will show 'Ouverture' and etc... but if user enter a feedback(for an example i am saying feedback).. possiblity of matching those phrase with our file define is less, wheather we need to create new file everytime..? Thanks from Manivannan.s |
| |||
| hi, what is satellite assembly? and how to use it to implement multi-language website? |
| |||
| hi definition from MSDN says something like this: "A .NET Framework assembly containing resources specific to a given language. Using satellite assemblies, you can place the resources for different languages in different assemblies, and the correct assembly is loaded into memory only if the user elects to view the application in that language." This means that you develop your application in a default language and add flexibility to react with change in the locale. Say, for example, you developed your application in an en-US locale. Now, your application has multilingual support. When you deploy your code in, say, India, you want to show labels, messages shown in the national language which is other than English. Satellite assemblies give this flexibility. You create any simple text file with translated strings, create resources, and put them into the bin\debug folder. That's it. The next time, your code will read the CurrentCulture property of the current thread and accordingly load the appropriate resource. This is called the hub and spoke model. It requires that you place resources in specific locations so that they can be located and used easily. If you do not compile and name resources as expected, or if you do not place them in the correct locations, the common language runtime will not be able to locate them. As a result, the runtime uses the default resource set. How do creating a Satellite Assembly ? 1.Create a folder with a specific culture name (for example, en-US) in the application's bin\debug folder. 2.Create a .resx file in that folder. Place all translated strings into it. 3.Create a .resources file by using the following command from the .NET command prompt. (localizationsample is the name of the application namespace. If your application uses a nested namespace structure like MyApp.YourApp.MyName.YourName as the type of namespace, just use the uppermost namespace for creating resources files—MyApp.) resgen Strings.en-US.resx LocalizationSample. Strings.en-US.resources al /embed:LocalizationSample.Strings.en-US.resources /out:LocalizationSample.resources.dll /c:en-US The above step will create two files, LocalizationSample.Strings.en-US.resources and LocalizationSample.resources.dll. Here, LocalizationSample is the name space of the application. 4.In the code, find the user's language; for example, en-US. This is culture specific. 5.Give the assembly name as the name of .resx file. In this case, it is Strings. refer this link for more details, it may be helpful to u ONDotnet.com -- .NET Localization, Part 2: Creating Satellite Assemblies |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi-Browser Compatibility | santhakumar | Web Design Help | 2 | 11-27-2007 09:16 PM |
| I have multi checkbox in my form... | gk_cloud | PHP Programming | 2 | 10-22-2007 06:31 AM |
| How to get multi combobox value in php | gk_cloud | PHP Programming | 8 | 10-16-2007 12:48 AM |
| In Microsoft Surface Website. Why they have used Adobe Flash in their website instead | theone | Microsoft | 1 | 07-27-2007 06:12 AM |
| multi tasking, multi programming, multi threading | vigneshgets | Operating Systems | 1 | 07-18-2007 05:12 AM |