PoshCode Archive  Artifact [07852ce6e3]

Artifact 07852ce6e394c577036d46def03e8a8dc513c4bac1db3f56dc8b7c8de67cd858:

  • File Invoke-LocalizedScript-p.ps1 — part of check-in [52ccb53c5b] at 2018-06-10 13:06:34 on branch trunk — From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes (user: Lee Holmes size: 755)

# encoding: ascii
# api: powershell
# title: Invoke-LocalizedScript.p
# description: From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes
# version: 0.1
# author: Lee Holmes
# license: CC0
# x-poshcode-id: 2181
# x-archived: 2016-05-17T17:20:48
# x-published: 2011-09-09T21:41:00
#
#
Set-StrictMode -Version Latest

## Create some default messages for English cultures, and
## when culture-specific messages are not available.
$messages = DATA {
    @{
        Greeting = "Hello, {0}"
        Goodbye = "So long."
    }
}

## Import localized messages for the current culture.
Import-LocalizedData messages -ErrorAction SilentlyContinue

## Output the localized messages
$messages.Greeting -f "World"
$messages.Goodbye