You are developing an ASP.NET MVC application in Visual Studio 2012. The application supports
multiple cultures.
The application contains three resource files in the Resources directory:
My Dictionary.resx
MyDictionary.es.resx
MyDictionary.fr.resx
Each file contains a public resource named Title with localized translation.
The application is configured to set the culture based on the client browser settings.
The application contains a controller with the action defined in the following code segment. (Line
numbers are included for reference only.)
You need to set ViewBag.Title to the localized title contained in the resource files.
Which code segment should you add to the action at line 03?
A.
ViewBag.Title = HttpContext.GetGlobalResourceObuect(“MyDictionary”, “Title”);
B.
ViewBag.Title = HttpContext.GetGlobalResourceObject(“MyDictionary”, “Title”,
new System.Globalization.CultureInfo(“en”));
C.
ViewBag.Title = Resources.MyDictionary.Title;
D.
ViewBag.Title = HttpContext.GetLocalResourceObject(“MyDictionary”, “Title”);
Explain pls?
That is just standard use of resources(*.resx)/localization in .net.
The LocalizedText attribute has no language indicator, culture indicator, or .resx extension, because it is not the actual file name. Instead, LocalizedText represents the base resource class. Depending on the culture sent by the browser, ASP.NET will select the resource out of the file with the appropriate language or culture code within its file name, such as LocalizedText.fr.resx, LocalizedText.es-mx.resx, or if no matching language is found, LocalizedText.resx.
https://msdn.microsoft.com/en-us/library/fw69ke6f.aspx