Exercise 8-2. Language Auto-Detection in Visual Basic .NET

Creation PDF 417 in Visual Basic .NET Exercise 8-2. Language Auto-Detection

Exercise 8-2. Language Auto-Detection
PDF-417 2d Barcode Printer In VB.NET
Using Barcode creator for Visual Studio .NET Control to generate, create PDF 417 image in Visual Studio .NET applications.
www.OnBarcode.com
Decode PDF 417 In Visual Basic .NET
Using Barcode reader for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
In this exercise, you are going to format a date string. Without changing any code, the format of the date will re ect whatever the preferred language is set to for the browser. 1. Create a new web project, and after the project loads, click on the Source tab of the Default.aspx page that was included in the project. At the top of the page will be the following page declaratives: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
Create Code128 In VB.NET
Using Barcode generator for .NET Control to generate, create Code 128 Code Set C image in .NET applications.
www.OnBarcode.com
Data Matrix 2d Barcode Generation In Visual Basic .NET
Using Barcode drawer for .NET framework Control to generate, create Data Matrix 2d barcode image in .NET applications.
www.OnBarcode.com
CHAPTER 8 LOCALIZATION
GTIN - 12 Generator In VB.NET
Using Barcode generator for Visual Studio .NET Control to generate, create GTIN - 12 image in Visual Studio .NET applications.
www.OnBarcode.com
ANSI/AIM Code 39 Printer In VB.NET
Using Barcode creator for .NET Control to generate, create Code 39 Extended image in .NET applications.
www.OnBarcode.com
You are going to add the following page declarative: Culture="auto" The complete page declarative will look like this: <%@ Page Culture="auto" Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> The Default.aspx page is all set up for the page to auto-detect the preferred language of the user s browser. 2. Now let s add the actual code. Double-click on the Design view of the Default.aspx page. Add the following code to the Page_Load method: Response.Write("Today is: " & DateTime.Now.ToLongDateString()) This code will write the current date to the browser in a long date string format. 3. First let s make sure the default language is set to English, or en-US. Refer to the earlier example on how to change the default language. You might not have to change your setting at all. Once the language is set, you are ready to test your example. 4. Build and run the web project. Figure 8-5 shows the localization of the current date on the web page.
Creating Barcode In VB.NET
Using Barcode creator for .NET Control to generate, create Barcode image in VS .NET applications.
www.OnBarcode.com
USD-4 Maker In Visual Basic .NET
Using Barcode generator for VS .NET Control to generate, create Code-27 image in .NET applications.
www.OnBarcode.com
Figure 8-5. English localization of current date You will notice that a caption is written to the browser displaying the current date with an English format that is used in the United States. Let s test another language. 5. Click on the Tools menu in the Internet Explorer browser of your running web application. Choose Internet Options and you will be presented with the Internet Options dialog box window. From there click on the Language button, and if you don t have another language in the list, add one from the language list. For this example; we are going to choose German (Germany) [de]. The last step is to ensure that the German selection is at the top of the list. Upon doing so, click OK on the language window and OK on the Internet Options window. Finally, click the Refresh button on the browser. In Figure 8-6 you will see the same code for displaying the date in a German format.
Print PDF-417 2d Barcode In Java
Using Barcode maker for Java Control to generate, create PDF-417 2d barcode image in Java applications.
www.OnBarcode.com
Create PDF-417 2d Barcode In Java
Using Barcode printer for BIRT reports Control to generate, create PDF-417 2d barcode image in BIRT applications.
www.OnBarcode.com
CHAPTER 8 LOCALIZATION
Making Code 128A In Objective-C
Using Barcode maker for iPad Control to generate, create Code-128 image in iPad applications.
www.OnBarcode.com
Recognizing Data Matrix In VS .NET
Using Barcode recognizer for .NET framework Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Figure 8-6. German localization of current date 6. Practice and experiment changing your preferred languages for your browser. This will simulate what other users will see in other countries and other cultures. This exercise showed you how without changing any code and by using the auto page declarative, the format of the date will change according to the language preference set in the browser.
QR Encoder In Java
Using Barcode maker for Java Control to generate, create QR image in Java applications.
www.OnBarcode.com
Generate Data Matrix ECC200 In Java
Using Barcode printer for Eclipse BIRT Control to generate, create Data Matrix ECC200 image in BIRT reports applications.
www.OnBarcode.com
Resource Expressions
Barcode Decoder In Java
Using Barcode Control SDK for Java Control to generate, create, read, scan barcode image in Java applications.
www.OnBarcode.com
Barcode Generation In Java
Using Barcode creator for Eclipse BIRT Control to generate, create Barcode image in BIRT applications.
www.OnBarcode.com
Many times you will need to have more control over what your web pages display for different languages and cultures that the auto detect does not provide. More control will come in the form of using resource files, which are XML-based files usually with an extension of .resx when used with ASP.NET 2.0 that contain objects and strings within the XML tags. In regard to our focus on localization and globalization in this chapter, they contain the different language information. The two main types of resource files are explicit and implicit. Let s look at their similarities and differences. Explicit: Provides more control on how the properties are set for controls within Web Forms. The expression is evaluated by pointing to a specific resource file. Once the expression is located in the resource file, it is evaluated and the value is set to the property. The ability to have more control over how the properties will be set for controls is helpful, in that you need to specify the properties and the scenario is not an all-ornothing proposition, thus allowing you to pick and choose what needs to be set. This type of localization is best used for large bodies of text or for implementing custom messages. Implicit: Implicit localization is a more general type of formatting. It is used for controls, but not all properties need to be identified to be localized. This differs from the explicit type because the properties specified are read automatically from the resource file.
DataMatrix Generator In None
Using Barcode generator for Font Control to generate, create Data Matrix 2d barcode image in Font applications.
www.OnBarcode.com
Barcode Generation In Java
Using Barcode drawer for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
UCC - 12 Maker In None
Using Barcode creation for Software Control to generate, create EAN128 image in Software applications.
www.OnBarcode.com
QR-Code Generator In None
Using Barcode encoder for Software Control to generate, create QR Code 2d barcode image in Software applications.
www.OnBarcode.com
Copyright © OnBarcode.com . All rights reserved.