Showing posts with label Localization/Globalization. Show all posts
Showing posts with label Localization/Globalization. Show all posts

What is deployment? How do you deploy .Net and Java applications

Deployment - It is the procedure to deploy Web Application on the Server. You can deploy .Net application by simply Xcopy and create virtual directory for the application on server.

what is marshling?

Marshaling performs the necessary conversions in data formats between managed and unmanaged code.CLR allows managed code to interoperate with unmanaged code usining COM Marshaler(Component of CLR).

Can resource file be in any other format other than resx extensions?

Yes they can be in .txt format in name and value pairs. For instance below is a simple .txt file with values.
lblUserId = User Id
lblPassword = Password
cmdSubmitPassword = Submit

What are resource files and how do we generate resource files?

Resource files are files which contain program resources. Many programmers think resource files for only storing strings. But you can also store bitmaps, icons, fonts, wav files in to resource files. In order to generate resource file you need click on tools – generate local resource as shown in the figure below. Do not forget to keep page in designer view or else you will not see the option. Once you generate the resource file you will see the resx file generated in the solution explorer.
If you see the resource file it has basically key and the value for the key.


If you see the above figure the key is basically the object name. You can see the Label1 has some value stored in the resource file.

Which are the important namespaces during localization and globalization?

There are two most important namespaces:-
√ System.Globalization - contains classes that define culture-related information, including the language, the country/region, the calendars in use, the format patterns for dates, currency and numbers, and the sort order for strings.
√ System.Resources - provides classes and interfaces that allow developers to create, store, and manage various culture-specific resources used in an application. With this namespace you can read a resource file and display it accordingly to the user’s culture.

How do we get the current culture of the environment in windows and ASP.NET?

"CultureInfo.CurrentCulture" displays the current culture of the environment. For instance if you are running Hindi it will display "hi-IN". Please note one thing in mind "CurrentCulture" will only give you the culture on which your application is running. So if it’s a windows application this will work fine. But in ASP.NET 2.0 we need to know what culture the end user has. For a real international website you different users can log in with different culture. For instance you can see from the given figure below different users are logging in with different regional settings. Client browser sends the information in the request headers to the server. For instance a Korean user will send "KO" in the request headers to server. We can get the value using the" Request.UserLanguages".

Regional settings are defined on the user’s browser as shown below. Click on Tools – Internet options – Languages. You can then add languages in the language preference box. Using "Move up" and "Move down" you can define the priority of the languages. In the below figure we have four languages defined with "Hindi" language set at the top priority. " Request.UserLanguages" returns back an array of string with the sorted order defined in your language preference tab of the browser.Below is the code snippet which shows how we can display the user languages. The first figure is the code snippet which shows how to use "Request.UserLanguages". The second figure shows the output for the same.



One of the things to be noted is "q" value. "q" stands for quality factor. In the above figure the quality factor means the following:- "I prefer Hindi, but will accept English US (with 80% comprehension) or Greek (with 50% comprehension) or French (with 30 % comprehension)." Just for Non-English speakers meaning of Comprehension. It is the process of understanding and constructing meaning from a piece of text. The comprehension is from the perspective of the end user. It says the end browser user will understand with this much comprehension for that language. For instance in the above example the end browser under stands English comprehension of 80 %.

What architecture decisions you should consider while planning for international software’s?

Avoid hard coding of strings in the project. Any display right from labels to error messages read it from a resource file.
√ Length of the string is also of prime importance. It’s a noted fact that when we translate English language in to other language the words increase by minimum 30 to 40 %. For instance you can see from the below figure how the Hindi text has increased as compared to English text.

So all your labels, message boxes have to be designed in such a way that this text size mismatch is adjusted. Do not crowd all your fields on one screen you will definitely end with the text length issue. Leave some room for expansion.

√ Decimal separator varies from locale to locale. For instance 25, 12.80 in the United States is 25.12,80 in Greece or Germany. Yes you guessed right the decimal separator in Europe is a "," (Comma).

√ Calendar changes from country to country. Definitely Gregorian calendar is the most used. But there are some other calendars like Hebrew, Islamic, Chinese etc. All these calendars have huge differences. For instance Nepal follows Nepali Calendar which is 56.7 years ahead of Gregorian calendar. So according to cultural settings user can expect the dates accordingly.

√ Sort order is affected by language. You can see from the figure below Hindi and English languages have different sorting order.


√ Time varies from locale to locale. For instance an 8 PM in India is 20:00 in Europe. In Europe there is not concept of AM and PM.

√ If you are using built-in fonts use the resource file to bundle the same. You can load the fonts from the resource file rather than telling the user explicitly to install the fonts in his PC.

√ Keyboards layout changes according locale and region. So be careful while designing the short cut keys. The function keys are mostly present in all key boards. Probably you can consider the function keys for short cut keys. Below is a sample Hindi key board. If you define CTRL + V as a short cut for paste functionality it can create confusion for Hindi users on the below key board.

So you can see from the above points that making software adapt to global culture is only related to string translation. It’s much beyond that.

What’s the difference between localization and globalization?

Below are the definition’s which is taken from the Microsoft glossary.
Globalization: It is the process of developing a program core whose features and code design are not solely based on a single language or locale.
Localization: The process of adapting a program for a specific local market, which includes translating the user interface, resizing dialog boxes, customizing features (if necessary), and testing results to ensure that the program still works. You can visualize globalization as more of architecture decisions. While localization is adapting your content to local market. Localization phase occurs before globalization phase.

Does .NET support UNICODE and how do you know it supports?

Yes .NET definitely supports UNICODE. Try to see sizeof (char), you will see 2 bytes. Char type data type stores only one character which needs only 8 bits but because .NET has to support UNICODE it uses 16 bits to store the same.

What is Unicode and why was it introduced?

In order to understand the concept of Unicode we need to move little back and understand ANSI code. ASCII (ask key) stands for American Standard Code for Information Interchange. In ASCII format every character is represented by one byte (i.e. 8 bits). So in short we can have 256 characters (2^8). Before UNICODE came in to picture programmers used code page to represent characters in different languages. Code page is a different interpretation of ASCII set. Code pages keep 128 characters for English and the rest 128 characters are tailored for a specific language. Below is a pictorial representation of the same.
There are following disadvantages of the CODE page approach:-
√ Some languages like Chinese have more than 5000 characters which is difficult to represent only 128 character set.
√ Only two languages can be supported at one time. As said in the previous note you can use 128 for English and the rest 128 for the other language.
√ The end client should have the code page.
√ Code Representation change according to Operating system and Language used. That means a character can be represented in different numbers depending on operating system. For all the above problems UNICODE was introduced. UNICODE represents characters with 2 bytes. So if its two bytes that means 18 bits. You can now have 2^16 characters i.e. 65536 characters. That's a huge number you can include any language in the world. Further if you use surrogates you can have additional 1 million characters...Hmm that can include type of language including historian characters. ASCII representation varied according to operating system and language. But in UNICODE it assigns a unique letter for every character irrespective of Language or operating system which makes programmers life much easier while developing international compatible applications.