Skip to content

Retrieves culture related data from the local computer and the Internet and writes the datasets as table formatted files (a Windows PowerShell script).

License

Notifications You must be signed in to change notification settings

auberginehill/get-culture-tables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Get-CultureTables.ps1

OS: Windows
Type: A Windows PowerShell script
Language: Windows PowerShell
Description: Get-CultureTables accesses the System.Globalization.CultureInfo .NET Framework Class Library and tries to read the AllCultures CultureType, which lists all the cultures that ship with the .NET Framework, including neutral and specific cultures, cultures installed in the Windows operating system (InstalledWin32Cultures) and custom cultures created by the user. The info is written to a CSV-file (cultures.csv) and the results are outputted to a pop-up window (Out-GridView).

After checking that the computer is connected to the Internet Get-CultureTables tries to download culture related data from several different domains and write that info to separate files at $path. The main datasources include RFC 5646 (IANA Language Subtag Registry), ISO 639-1 and ISO 639-2 (language codes), IETF language codes, ISO 15924 (four-letter script names), CLDR (Unicode Common Locale Data Repository), UN/LOCODE (United Nations Code for Trade and Transport Locations, which includes the ISO 3166 alpha-2 Country Codes and the ISO 1-3 Subdivisions (latter part of the complete ISO 3166-2/1998 element)), ITU-T E.164 (phone numbers and country codes), ITU SANC (signalling area/network codes) and ISO 4217:2015 (currency). Please see the Outputs-section below for the full filelist.
Homepage: https://github.com/auberginehill/get-culture-tables
Short URL: http://tinyurl.com/js78k4h
Version: 1.1
Sources:
Emojis: Emoji Table
ps1: Test Internet connection (or one of the archive.org versions)
Ameer Deen: How to zip/unzip files in Powershell?
Downloads: For instance Get-CultureTables.ps1. Or everything as a .zip-file.

Screenshot

      screenshot

Outputs

➡️
  • Displays the local machine culture information in a pop-up window "$cultures_selection" (Out-GridView).

  • A pop-up window (Out-GridView):
    1. Name Description
      $cultures_selection Displays a list of .NET Framework cultures

  • and writes that data to a file as described below. Also, if a working internet connection is detected, after accessing several domains Get-CultureTables writes in the default scenario the following files at $path ($env:temp):
    1. Path File Type Description
      $env:temp\cultures.csv CSV .NET Framework "AllCultures" CultureType in System.Globalization.CultureInfo
      $env:temp\languages_IANA.txt TXT Internet Assigned Numbers Authority (IANA) Language Subtag Registry (RFC 5646) original
      $env:temp\languages_IANA.csv CSV Internet Assigned Numbers Authority (IANA) Language Subtag Registry (RFC 5646)
      $env:temp\languages_ISO_639.csv CSV ISO 639-1 and ISO 639-2 Registration Authority (RA) Language Codes as hosted by US Library of Congress
      $env:temp\languages_IETF.csv CSV Internet Engineering Task Force (IETF) Language Codes
      $env:temp\script_names_ISO_15924.csv CSV ISO 15924 four-letter Script Names
      $env:temp\unicode_license.txt TXT Unicode Common Locale Data Repository (CLDR) Licence
      $env:temp\unicode_languageInfo.xml XML Unicode Common Locale Data Repository (CLDR) Language Info
      $env:temp\unicode_supplementalData.xml XML Unicode Common Locale Data Repository (CLDR) Supplemental Data
      $env:temp\unicode_windowsZones.xml XML Unicode Common Locale Data Repository (CLDR) Windows Zones
      $env:temp\unicode_telephoneCodeData.xml XML Unicode Common Locale Data Repository (CLDR) Telephone Code Data
      $env:temp\unicode_subdivisions.xml XML Unicode Common Locale Data Repository (CLDR) Subdivisions
      $env:temp\unicode_numberingSystems.xml XML Unicode Common Locale Data Repository (CLDR) Numbering Systems
      $env:temp\unicode_metaZones.xml XML Unicode Common Locale Data Repository (CLDR) Meta Zones
      $env:temp\unicode_likelySubtags.xml XML Unicode Common Locale Data Repository (CLDR) Likely Subtags
      $env:temp\unicode_dayPeriods.xml XML Unicode Common Locale Data Repository (CLDR) Day Periods
      $env:temp\unicode_currency.xml XML Unicode Common Locale Data Repository (CLDR) Currency
      $env:temp\unlocode_notes.pdf PDF UN/LOCODE Notes
      $env:temp\unlocode_subdivisions.csv CSV UN/LOCODE Subdivisions
      $env:temp\unlocode.csv CSV United Nations Code for Trade and Transport Locations (UN/LOCODE)
      $env:temp\unlocode_recommendation.pdf PDF UNECE Recommendation No. 16 on UN/LOCODE
      $env:temp\unlocode_manual.pdf PDF UN/LOCODE Manual
      $env:temp\itu_country_codes_E.164.pdf PDF International Telecommunication Union (ITU) ITU-T E.164 Phone Numbers and Country Codes
      $env:temp\itu_network_codes_SANC.pdf PDF International Telecommunication Union (ITU) Signalling Area/Network Codes (SANC)
      $env:temp\itu_mobile_codes.pdf PDF International Telecommunication Union (ITU) Mobile Country or Geographical Area Codes
      $env:temp\itu_geographical_non-std.pdf PDF International Telecommunication Union (ITU) List of Country or Geographical Area Codes for non standard facilities in telematic services
      $env:temp\itu_geographical_codes.pdf PDF International Telecommunication Union (ITU) List of Data Country or Geographical Area Codes
      $env:temp\itu_terrestrial_codes.pdf PDF International Telecommunication Union (ITU) List of terrestrial trunk radio mobile country codes
      $env:temp\itu_telegram_codes.pdf PDF International Telecommunication Union (ITU) Five-letter Code Groups for the use of the International Public Telegram Service
      $env:temp\currency_current_ISO_4217.xls XLS ISO 4217:2015 Currency
      $env:temp\currency_fund_codes.doc DOC Fund Codes List
      $env:temp\currency_historic.xls XLS List of codes for historic denominations of currencies

Notes

⚠️
  • Please note that all the Unicode Common Locale Data Repository (CLDR) files (listed in the above table as unicode_*.*), which are generated in Step 7 are bound to the Unicode License (unicode_license.txt).

  • Please note that the United Nations' dataset of esu lacitsitats rof snoiger lacihpargoeg dna sedoc aera ro yrtnuoc dradnats1 (Step 10) is not downloaded by default due to the restrictive copyright in effect (only reading of the web page is permitted for all users). If a permission is granted by the copyright owner (UN), however, the excellent UN data could, perhaps, be actually used for something.
  • ISO 3166 has three parts:
      Name Description
      ISO 3166‑1 Officially assigned codes for countries.
      (n = ~249)
      ISO 3166‑2 Subdivision codes.
      The codes for subdivisions (ISO 3166-2) are represented as the Alpha-2 code for the country, followed by a dash and up to three additional characters. For example ID-RI is the Riau province of Indonesia and NG-RI is the Rivers province in Nigeria. The codes denoting the subdivision are usually obtained from national sources and stem from coding systems already in place in the country.
      ISO 3166‑3 Formerly used codes.
      i.e. codes that were once used to describe countries but are no longer in use.
  • The ISO 3166-1 country codes in ISO 3166 can be represented either as a two-letter code (Alpha-2 code), which is recommended as the general purpose code, a three-letter code (Alpha-3 code), which is more closely related to the country name and/or a three digit numeric code (Numeric-3).
      Name Description
      ISO 3166‑1 Alpha‑2 code A two-letter code that represents a country name, recommended as the general purpose code.
      ISO 3166‑1 Alpha‑3 code A three-letter code that represents a country name, which is usually more closely related to the country name.
      ISO 3166‑1 Numeric‑3 code A three-digit numeric code that represents a country name.
      Alpha‑4 code A four-letter code that represents a country name that is no longer in use.
  • The ISO 3166-1 officially assigned country codes may be displayed in a browser by opening the ISO Online Browsing Platform (OBP) page and clicking the following items:
    1. Country codes
    2. 🔍 (Search)
    3. Results per page: 300
  • Please note that the files are created in a directory, which is specified with the $path variable (at line 7). The $env:temp variable points to the current temp folder. The default value of the $env:temp variable is C:\Users\<username>\AppData\Local\Temp (i.e. each user account has their own separate temp folder at path %USERPROFILE%\AppData\Local\Temp). To see the current temp path, for instance a command

    [System.IO.Path]::GetTempPath()

    may be used at the PowerShell prompt window [PS>]. To change the temp folder for instance to C:\Temp, please, for example, follow the instructions at Temporary Files Folder - Change Location in Windows, which in essence are something along the lines:
    1. Right click on Computer and click on Properties (or select Start → Control Panel → System). In the resulting window with the basic information about the computer...
    2. Click on Advanced system settings on the left panel and select Advanced tab on the resulting pop-up window.
    3. Click on the button near the bottom labeled Environment Variables.
    4. In the topmost section labeled User variables both TMP and TEMP may be seen. Each different login account is assigned its own temporary locations. These values can be changed by double clicking a value or by highlighting a value and selecting Edit. The specified path will be used by Windows and many other programs for temporary files. It's advisable to set the same value (a directory path) for both TMP and TEMP.
    5. Any running programs need to be restarted for the new values to take effect. In fact, probably also Windows itself needs to be restarted for it to begin using the new values for its own temporary files.

  • 1 In PowerShell, please try:

      $string = "This is a test."
      ([regex]::Matches($string,'.','RightToLeft') | ForEach { $_.Value }) -join ''
      Source: Reversing a String Using PowerShell

Examples

📖 To open this code in Windows PowerShell, for instance:

  1. ./Get-CultureTables
    Run the script. Please notice to insert ./ or .\ before the script name.
  2. help ./Get-CultureTables -Full
    Display the help file.
  3. Set-ExecutionPolicy remotesigned
    This command is altering the Windows PowerShell rights to enable script execution for the default (LocalMachine) scope. Windows PowerShell has to be run with elevated rights (run as an administrator) to actually be able to change the script execution properties. The default value of the default (LocalMachine) scope is "Set-ExecutionPolicy restricted".

    Parameters:

      Restricted Does not load configuration files or run scripts. Restricted is the default execution policy.
      AllSigned Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on the local computer.
      RemoteSigned Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
      Unrestricted Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet, you are prompted for permission before it runs.
      Bypass Nothing is blocked and there are no warnings or prompts.
      Undefined Removes the currently assigned execution policy from the current scope. This parameter will not remove an execution policy that is set in a Group Policy scope.

    For more information, please type "Get-ExecutionPolicy -List", "help Set-ExecutionPolicy -Full", "help about_Execution_Policies" or visit Set-ExecutionPolicy or about_Execution_Policies.

  4. New-Item -ItemType File -Path C:\Temp\Get-CultureTables.ps1
    Creates an empty ps1-file to the C:\Temp directory. The New-Item cmdlet has an inherent -NoClobber mode built into it, so that the procedure will halt, if overwriting (replacing the contents) of an existing file is about to happen. Overwriting a file with the New-Item cmdlet requires using the Force. If the path name includes space characters, please enclose the path name in quotation marks (single or double):

      New-Item -ItemType File -Path "C:\Folder Name\Get-CultureTables.ps1"

    For more information, please type "help New-Item -Full".

Contributing

Find a bug? Have a feature request? Here is how you can contribute to this project:

contributing Bugs: Submit bugs and help us verify fixes.
Feature Requests: Feature request can be submitted by creating an Issue.
Edit Source Files: Submit pull requests for bug fixes and features and discuss existing proposals.

www

www Script Homepage
ps1: Test Internet connection (or one of the archive.org versions)
Ameer Deen: How to zip/unzip files in Powershell?
CultureTypes Enumeration
ASCII Art: http://www.figlet.org/ and ASCII Art Text Generator

Related scripts

www Disable-Defrag
Firefox Customization Files
Get-AsciiTable
Get-BatteryInfo
Get-ComputerInfo
Get-DirectorySize
Get-InstalledPrograms
Get-InstalledWindowsUpdates
Get-PowerShellAliasesTable
Get-PowerShellSpecialFolders
Get-RAMInfo
Get-TimeDifference
Get-TimeZoneTable
Get-UnusedDriveLetters
Emoji Table
Java-Update
Remove-EmptyFoldersLite
Remove-EmptyFolders
Rename-Files
Rock-Paper-Scissors
Toss-a-Coin
Update-AdobeFlashPlayer
Update-MozillaFirefox

About

Retrieves culture related data from the local computer and the Internet and writes the datasets as table formatted files (a Windows PowerShell script).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published