The culture assembly attribute is probably the most complex but very important one. And we have to bear something in mind when taking it into account.
Firstly, the EXE cannot have the culture attribute.
If we do provide something to the AssemblyCulture attribute in the AssemblyInfo source of an executable project, like follows:
[assembly: AssemblyTitle("This is Title")]
[assembly: AssemblyDescription("This is Description")]
[assembly: AssemblyConfiguration("This is Configutation")]
[assembly: AssemblyCompany("This is Company")]
[assembly: AssemblyProduct("This is Product")]
[assembly: AssemblyCopyright("This is Copyright")]
[assembly: AssemblyTrademark("This is Trademark")]
[assembly: AssemblyCulture("en")]
When the project is being built, an error will come up:
“Error emitting 'System.Reflection.AssemblyCultureAttribute' attribute -- 'Executables cannot be satellite assemblies, Culture should always be empty'”
Here is the official statement about the Culture assembly attribute from MSDN:
“The attribute is used by compilers to distinguish between a main assembly and a satellite assembly. A main assembly contains code and the neutral culture's resources. A satellite assembly contains only resources for a particular culture, as in [assembly:AssemblyCultureAttribute("de")]. Putting this attribute on an assembly and using something other than the empty string ("") for the culture name will make this assembly look like a satellite assembly, rather than a main assembly that contains executable code. Labeling a traditional code library with this attribute will break it, because no other code will be able to find the library's entry points at runtime.”
Secondly, the culture name can only come from a fixed enumeration list, which is unfortunately is operating system dependant.
The good thing is that the following MSDN web site provides all the available NL (National Languages) for each Windows:
National Language Support (NLS) API Reference
http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx
Here are some popular ones:
Culture name (used in the attribute) Locale (Language Country/Region) Language
zh Chinese Chinese
zh-Hans Chinese (Simplified) Chinese (Simplified)
zh-CN Chinese (Simplified, PRC) Chinese (Simplified)
zh-Hant Chinese (Traditional) Chinese (Traditional)
zh-TW Chinese (Traditional, Taiwan) Chinese (Traditional)
En English English
en-GB English (United Kingdom) English
en-US English (United States) English
fr French French
fr-FR French (France) French
fr-CA French (Canada) French
de German German
de-DE German (Germany) German
de-AT German (Austria) German
it Italian Italian
it-IT Italian (Italy) Italian
it-CH Italian (Switzerland) Italian
ko Korean Korean
ko-KR Korean (Korea) Korean
pt Portuguese Portuguese
pt-PT Portuguese (Portugal) Portuguese
pt-BR Portuguese (Brazil) Portuguese
ru Russian Russian
ru-RU Russian (Russia) Russian
es Spanish Spanish
es-ES Spanish (Spain, International Sort) Spanish
es-MX Spanish (Mexico) Spanish
Thirdly, the .NET culture feature is not that simple as a text, string, or name as shown above. It is complicated. If we bear in mind one thing after reading this article it may be enough and good for now.
The assembly culture attribute is to specify what culture including both language and country/region the satellite assembly (instead of an executable or API library) is designed for.
In terms of how to manage culture (or most commonly language) specific resources like strings, icons, images, dialogs, fonts, and so on in a satellite assembly, it is a broad and complex topic. We may address something about it in the future.
AssemblyInfo Updater of RevitAddinWidget can help review popular assembly information of all available projects in a Visual Studio solution and update the information conveniently and flexibly in a single central place.
Recent Comments