国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Database Mysql Tutorial Architecture FAQ for Localization and Globalization Part 2

Architecture FAQ for Localization and Globalization Part 2

Jun 07, 2016 pm 03:44 PM
faq for

http://www.codeproject.com/Articles/29362/Architecture-FAQ-for-Localization-and-Globalizatio Architecture FAQ for Localization and Globalization Introduction (B) What are satellite assemblies? (A) How do we generate Satellite assemblies? (

http://www.codeproject.com/Articles/29362/Architecture-FAQ-for-Localization-and-Globalizatio

Architecture FAQ for Localization and Globalization


Introduction

(B) What are satellite assemblies?

(A) How do we generate Satellite assemblies?

(A) What is AL.EXE and RESGEN.EXE?

(I) What is the use of resource manager class?

(A) What precautions do we need to take while deploying satellite assemblies?

(A) Can you explain the fundamentals of “GetGlobalResourceObject” and “GetLocalResourceObject” functions?

(A) Can we sign a satellite assembly?

(I) Can you explain collation sequence in sql server?

(A)How do we define collation sequence for database and tables?

(A)Can we change the order in a select query with a specified collation sequence?

(A) Can you list best practices for globalization and localization?

References

Other Interview question PDF's

Introduction

You can see the part 1 of the article at:-?LocalizationGlobalizPart1.aspx???

When we see around, architectures mainly discuss about loose coupling , scalability , performance etc etc. Many architecture forget one of the important aspects in software is making application globalized. Depending on project some application would not really want to have multi-language based websites , but i am sure many will. So in this article we will go through a series of FAQ which will give you a quick start on making application multi-language based.

Lately i have been writing and recording videos heavily on design patterns , UML and many architectural stuff you can visit?http://www.questpond.com?for design pattern and UML videos.

You can read my previous articles on design patterns and UML in the below links:-

Part 1 – Design patterns Factory, Abstract factory, builder, prototype, shallow and deep copy, and singleton and command patterns

SoftArchInter1.aspx??

Part 2 – Design patterns Interpreter, Iterator, Mediator, Memento and observer patterns

SoftArch2.aspx?

Part 3 – Design patterns State, Stratergy, Visitor, Adapter and fly weight pattern

SoftArch3.aspx?

Part 4 Design patterns Bridge, Composite, Decorator, Facade, COR, Proxy and template pattern

SoftArch4.aspx

Loosely coupled architecture using

IOCDI.aspx?

You can download by architecture interview question book from?

http://www.questpond.com/softArchi.zip.zip??

?



(B) What are satellite assemblies?


(A) How do we generate Satellite assemblies?


(A) What is AL.EXE and RESGEN.EXE?


In the previous question, you have seen how we can use resource files to store data according to the localized languages. However, when you actually go for deployment you will not like to also install the “resx” or “txt” files. It is definitely not a good deployment practice to install data, which can be easily modified. In short some how we should install this in a binary format so that no end user can change it. That is why Microsoft introduced satellite assemblies.
Satellite assemblies are assemblies, which do not contain source code. They only contain resource files. You can create a satellite assembly using rsgen.exe and al.exe. They are in binary DLL format, which makes it easier to ship it during deployment. So finally, during deployment you do not need to ship the resx files but only the compiled satellite DLL.
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.15: - resgen.exe and al.exe in action


The above diagram will give you a complete picture of how to generate Satellite assembly. You can see from the above figure we need two exe resgen.exe and al.exe. Once you made your resx file or text file, you should first convert in to a “.resource” files. This is done by using the resgen.exe. Below is the command snippet for resgen.exe where LoginScreen.aspx.el.resx is the resx file and output is Greek. Resources file. If you do not provide the output file name it will generate “LoginScreen.resources”.

Resgen LoginScreen.aspx.el.resx Greek.Resources

You can also generate resx files from txt file using resgen.exe below is the code snippet for the same:-

Resgen MyLanguage.txt MyLanguage.resx

The above command snippet will generate a MyLanguage.resx using MyLanguag.txt file. You can make a DLL using resource files and not resx so you should make this conversion.
Now once the resource file is generated its time make the compiled assembly of the same so that it can be shipped during deployment. This is accomplished by using the assembly linker tool al.exe provided by Microsoft. Below is the command code snippet for the same.

al.exe /out: el.dll /c: de /embed: greek.resources

In the /out switch you need to provide the output DLL name. /c you need to specify the culture of the resource file. /embed you need to specify all the resources which are present in the resource file. As said previously other than strings you can also put image files like GIF, BMP etc. So those physical resources you can specify in the /embed switch. You can specify more than one resource use “,” as a separator to specify more than one resource files.?
?

(I) What is the use of resource manager class?


Resource Manager Class helps us to read the resource files and get the values using key.?
First, you need to create the object of resource manager. You need to specify the resource name and the assembly in the constructor.

privateResourceManagerobjResourceManager = new ResourceManager("Globalization.resource",System.Reflection.Assembly.GetExecutingAssembly());

Once the resource manager is populated with details, you can then use the Get String function to get by key. For instance in the below code snippet we are using the “cmdAddNew” key to get the value for button “cmdAddNew”.

cmdAddNew.Text = objResourceManager.GetString("cmdAddNew");
?

(A) What precautions do we need to take while deploying satellite assemblies?


When we deploy the assembly, the folder structure has to very organized. Below table shows how the folder structure should be organized. Main Folder is the main application folder. All satellite assemblies should be deployed in the Main application folder with in there own respective folder. The respective folder is denoted by the culture code.
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.16: - Satellite Assembly folder structure


You can see from the above figure Hindi satellite assembly is deployed in hi folder, Greek satellite assembly is deployed in el folder and so on. If the program does not find resource file for a culture it uses the invariant culture satellite assembly. The above folder structure is a strict requirement when we deploy the satellite assembly. Any mismatch in the folder structure will lead to in appropriate results.
?

(A) Can we get a strongly typed resource class rather than using resource manager?


In the previous question, we had seen how resource manager class could be used to read the string from the resource file. However, there has been considerable improvement in VS.Net 2005 for resource support. You no more need to load using resource manager class. However, Microsoft has still kept it for backward compatibility. You can now get strongly types classes in your VS.NET intelligence as shown in the figure below.
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.17: - Strongly typed resource class


All belong to Resources namespace. Let us do a small sample and see how the strongly typed classes work in VS.NET 2005 and the simplicity, which they bring while implementing globalization in projects. Below is the screen shot of the project? It is a simple login screen with user id and password text boxes. User has options to select the language. Currently only two languages are provided English and Greek. Depending on the languages selected, the user id and password label values will be displayed.?
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.18: - Strongly typed project


Note: - In the globalization project you can get the project sample in “LoginScreenUsingStrongType.aspx”.


Below is the code snippet, which describes the various important divs of the code. First thing are the resource files. We have generated two resource files one for Greece with el and second is the general resource file which will be used when the regional code does not match.?
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.19: - Walkthrough for using the resources namespace


There are three important steps in the code:-

? First is set the culture information for the current thread with the new culture info object. Structure has the language code, which is currently selected in the drop down.
Thread.CurrentThread.CurrentCulture = new CultureInfo (structure);

? We set the same culture to the Resource class.
Resources.Resource.Culture = Thread.CurrentThread.CurrentCulture;

? Now we are all set to use the value.
lblUserId.Text = Resources.Resource.lblUserIdResource1.ToString ();

blPassword.Text = Resources.Resource.lblPasswordResource1.ToString ();

Note: - You can get the same from globalization folder in “LoginScreenUsingStrongType.aspx”. Try to add a new language and most of the fundamentals will be clear.


(A) Can you explain the fundamentals of “GetGlobalResourceObject” and “GetLocalResourceObject” functions?


These two functions belong to the Http Context object. Using it you can get the object reference of the resource object. For instance you can see from the below code snippet we have reference to the Global resource object and we are trying to get the value for “l(fā)blUserIdresource1” key.

lblUserId.Text=HttpContext.GetGlobalResourceObject("Resource", "lblUserIdResource1").To String();
Note :- In the same globalization folder there is “LoginScreenUsingGetGlobal.aspx” which demonstrates how “GetGlobalResource” works.


One short note because “GetGlobalResourceObject” and “GetLocalResourceObject” operate from with in current HttpContext.It uses what the regional settings are sent from the browser end.
?

(A) Can we sign a satellite assembly?


Yes you can sign the satellite assembly using the /key file switch which takes “.snk” file as the input parameter.

al /res:MyLanguage.resources /c:de /keyfile:MyLang.snk out:MyLanguages.resources.dll
?

(I) Can you explain collation sequence in sql server?


First, let us define collation.
Collation sequences are set of rules, which determine how the data is sorted and compared. Sorting rules can be defined with options with case-sensitivity, accent marks, kana character types, and character width.

Case sensitivity

If A and a, B and b, etc. are treated in the same way then it is case-insensitive. A computer treats A and a differently because it uses ASCII code to differentiate the input. The ASCII value of A is 65, while a is 97. The ASCII value of B is 66 and b is 98.

Accent sensitivity

If a and á, o and ó are treated in the same way, then it is accent-insensitive. A computer treats a and á differently because it uses ASCII code for differentiating the input. The ASCII value of a is 97 and áis 225. The ASCII value of o is 111 and ó is 243.
Kana Sensitivity
When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive.?

Width sensitivity

When a single-byte character (half-width) and the same character when represented as a double-byte character (full-width) are treated differently then it is width sensitive.
?

(A)How do we define collation sequence for database and tables?


You can create a database with language specific collation sequence. For instance in the below create statement tblCustomer is created by Latin language collation sequence.?

Create database tblCustomer collate Latin1_General_BIN

You can also create tables with particular collation sequence. Below is the create table syntax for the same.

Create table tblCustomer?
(
[CustomerCode] char(10) COLLATE Albanian_CI_AI_KS_WS NULL,
[EntryDate] [char] (8) COLLATE Korean_Wansung_Unicode_CS_AS_KS NOT NULL ,
[CustAbbrev] [char] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL?
)


(A)Can we change the order in a select query with a specified collation sequence?


Yes we can specify a collate sequence in the order by clause. That will change the sort according to the collation defined in the order by claused.


ORDER BY?
{
order_by_expression?
[ COLLATE collation_name ]?
[ ASC | DESC ]?
} [ ,...n ] ]


(A) Can you list best practices for globalization and localization?


Below are the best practices while developing international language support software:-
? Do not hardcode strings or user interface resources.
? Make sure your application depends on Unicode.
? Whenever you read or write data from various encoding make, sure you use the System. Text namespace. Many programmers assume ASCII data.
? While testing test it with actual international data and environments.
? Whenever we manipulate data, for instance numbers, dates or currency make sure that you are using culture-aware classes defined in System. Globalization namespace. Below is the table, which specifies in more detail about the functionality and the classes to be used to achieve the same.
?

Architecture FAQ for Localization and Globalization Part 2

Figure 14.20: - Functionality and classes used


? ????If a security decision is based on the result of a string comparison or case change operation, perform a culture-insensitive operation by explicitly specifying the CultureInfo.InvariantCulture property. This practice ensures that the result is not affected by the value of CultureInfo.CurrentCulture.?
? Move all your localizable resources to separate DLL’s.
? Avoid using images and icons that contain text in your application. They are expensive to localize.
? Allow plenty of room for the length of strings to expand in the user interface. In some languages, phrases can require 50-75 percent more space.
? Use the System.Resources.ResourceManager class to retrieve resources based on culture.
? Explicitly set the CurrentUICulture and Current Culture properties in your application. Do not rely on defaults.
? Be aware that you can specify the following three types of encodings in ASP.NET:?
? Request Encoding specifies the encoding received from the client's browser.
? Response Encoding specifies the encoding to send to the client browser. In most situations, this should be the same as request Encoding.
? File Encoding specifies the default encoding for .aspx, .asmx, and .asax file parsing.
?

(A) Why is the culture set to the current thread?


First, let me explain this question. If you look at the code snippet of how to set the culture info.

Thread.CurrentThread.CurrentCulture = new CultureInfo(strCulture);
It uses the current thread to set it. What does that mean? Let us drill down a bit, of how IIS handles request to understand this concept. When any user requests a resource from IIS like an ASPX page or any other resource. IIS services that request in his own thread. That means if 100 users have requested some resource from IIS he will serve every request in its own thread. In short, IIS will spawn 100 threads to service the 100 request. It is very much practically possible that you can have different locale in different threads. Therefore, when we set a culture we cannotset it for the whole application, as it will affect all the requests. So when we set a culture we set it to a particular thread rather to the whole application.


About the Author

Shivprasad?koirala


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

17 ways to solve the kernel_security_check_failure blue screen 17 ways to solve the kernel_security_check_failure blue screen Feb 12, 2024 pm 08:51 PM

Kernelsecuritycheckfailure (kernel check failure) is a relatively common type of stop code. However, no matter what the reason is, the blue screen error causes many users to be very distressed. Let this site carefully introduce 17 types to users. Solution. 17 solutions to kernel_security_check_failure blue screen Method 1: Remove all external devices When any external device you are using is incompatible with your version of Windows, the Kernelsecuritycheckfailure blue screen error may occur. To do this, you need to unplug all external devices before trying to restart your computer.

How to uninstall Skype for Business on Win10? How to completely uninstall Skype on your computer How to uninstall Skype for Business on Win10? How to completely uninstall Skype on your computer Feb 13, 2024 pm 12:30 PM

Can Win10 skype be uninstalled? This is a question that many users want to know, because many users find that this application is included in the default program on their computers, and they are worried that deleting it will affect the operation of the system. Let this website help users Let’s take a closer look at how to uninstall Skype for Business in Win10. How to uninstall Skype for Business in Win10 1. Click the Windows icon on the computer desktop, and then click the settings icon to enter. 2. Click "Apply". 3. Enter "Skype" in the search box and click to select the found result. 4. Click "Uninstall". 5

How to use for to find the factorial of n in JavaScript How to use for to find the factorial of n in JavaScript Dec 08, 2021 pm 06:04 PM

How to use for to find n factorial: 1. Use the "for (var i=1;i<=n;i++){}" statement to control the loop traversal range to "1~n"; 2. In the loop body, use "cj *=i" Multiply the numbers from 1 to n, and assign the product to the variable cj; 3. After the loop ends, the value of the variable cj is the factorial of n, and then output it.

What is the difference between foreach and for loop What is the difference between foreach and for loop Jan 05, 2023 pm 04:26 PM

Difference: 1. for loops through each data element through the index, while forEach loops through the data elements of the array through the JS underlying program; 2. for can terminate the execution of the loop through the break keyword, but forEach cannot; 3. for can control the execution of the loop by controlling the value of the loop variable, but forEach cannot; 4. for can call loop variables outside the loop, but forEach cannot call loop variables outside the loop; 5. The execution efficiency of for is higher than forEach.

How to avoid exceptions in simple for loops in JAVA? How to avoid exceptions in simple for loops in JAVA? Apr 26, 2023 pm 12:58 PM

Introduction In actual business project development, everyone should be familiar with the operation of removing elements that do not meet the conditions from a given list, right? Many students can immediately think of many ways to achieve it, but are all the ways you think of harmless to humans and animals? Many seemingly normal operations are actually traps, and many novices may fall into them if they are not careful. If unfortunately, an exception is thrown and an error is reported when the code is running, this is a blessing. At least the code can be discovered and solved in time without an error being reported, but various strange problems appear inexplicably in the business logic. This is more tragic. Because if you don't pay attention to this problem, it may cause hidden dangers for subsequent business. So, what are the implementation methods? What implementations might

What are the common flow control structures in Python? What are the common flow control structures in Python? Jan 20, 2024 am 08:17 AM

What are the common flow control structures in Python? In Python, the flow control structure is an important tool used to determine the execution order of the program. They allow us to execute different blocks of code based on different conditions, or to execute a block of code repeatedly. The following will introduce common process control structures in Python and provide corresponding code examples. Conditional statements (if-else): Conditional statements allow us to execute different blocks of code based on different conditions. Its basic syntax is: if condition 1: #when condition

6 examples, 8 code snippets, detailed explanation of For loop in Python 6 examples, 8 code snippets, detailed explanation of For loop in Python Apr 11, 2023 pm 07:43 PM

Python supports for loops, and its syntax is slightly different from other languages ??(such as JavaScript or Java). The following code block demonstrates how to use a for loop in Python to iterate over the elements in a list: The above code snippet prints three letters in separate lines. You can limit the output to the same line by adding a comma "," after the print statement (if you specify a lot of characters to print, it will "wrap"), the code is as follows: When you want to display it in one line instead of multiple lines For text content, you can use the above form of code. Python also provides built-in

How to use PHP to develop FAQ and message board modules in CMS How to use PHP to develop FAQ and message board modules in CMS Jun 21, 2023 am 11:10 AM

With the gradual development of websites, more and more companies and organizations have begun to use websites as an important way to promote and provide services. In websites, modules such as FAQ (frequently asked questions) and message boards have also become essential modules for daily operations. . This article will introduce how to use PHP to develop FAQ and message board modules in CMS. 1. FAQ module database design The FAQ module is mainly divided into two parts: question list and answer list. In the database, we need to create question tables and answer tables respectively, as well as association tables between questions and answers. Question table structure

See all articles