LA.NET [EN]

Apr 14

Back to the basics: Culture

Posted in .NET Basics C#      Comments Off on Back to the basics: Culture

In a previous post about basic concepts, I’ve talked a little bit about the version number and about the different “types” of version you can find in an assembly. Today, I’ll proceed with the basics concepts series and we’ll take a quick detour into Cultures.

Cultures are identified by a string which can contain two parts, known as primary and secondary parts (I’ve seen them called tags too). Here’s an example: “en-GB”. The previous string identifies the current culture as British English. Notice that the secondary part isn’t really required (in that case, you’d end up with the string “en” and you could only infer that  the culture is English).

When building culture-aware applications, you should always have a culture neutral assembly (which contains code and the application’s default resources) and then create one or more separate assemblies which contains only culture specific resources (these assemblies are known as satellite assemblies). The only thing you need to keep in mind is that you must take some care when deploying your culture assemblies: by default, they must be put it in a subdirectory whose name matches the culture of the assembly (if your app is in a folder named Dumb and you’re deploying a British English assembly,  then you need to put that culture specific assembly in the Dumben-GB folder).

Before ending, don’t forget that the culture of the current assembly is also part of its identity! And I guess that’s it for now.