Recently I was working on a PowerShell project that involved internationalization. When researching the best approach, I learned about the
Import-LocalizedData Cmdlet and it made it incredibly easy to support internationalization in my scripts.
Before I really get into things, let me clarify a couple similar but distinct definitions (this is mostly for my own benefit, because I always get them mixed up):
- Localization is the process of translating and adapting a product’s strings and UI for a new language.
- Globalization is the process of preparing a product for localization. This is especially relevant for existing products there were initially built without internationalization in mind.
- Internationalization is the parent term for both globalization and localization.
There are actually quite a few definitions for these terms, but this is how Microsoft defines them. Since we’re talking about PowerShell, a Microsoft product, these are the definitions I’m going to stick with. So you could say that when you are working with internationalization you globalize your application so that it can be localized into multiple languages.
To demonstrate this process, let’s use a simple example. I’ve got a script called
PSUICultureExample.ps1 that looks like this: