If you need to convert a CSV file with terms to a RegX file for use in your .Net project, you can use this simple PowerShell script:
1 2 3 4 5 6 |
$items = Import-Csv "C:\strings.csv" -Delimiter ',' -Encoding Default [System.Resources.ResXResourceWriter]$resxWriter = New-Object System.Resources.ResXResourceWriter("c:\strings.resx") $items | ForEach-Object { $resxWriter.AddResource($_.Name, $_.Value); } $resxWriter.Close() |
The script assumes your CSV file contains two columns, “Name” and “Value”, such as this:
1 2 3 4 |
Name,Value MyString1,First value MyString2,Second value MyString3,Third value |
You can use Excel to export such files. You may need to change the -Delimiter parameter in the script to match your locale (Why? See my post on working with CSV files in Excel).