Pseudo-localization tool for .NET
Clone or download
Pull request Compare This branch is 94 commits ahead of anderskaplan:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.azure-pipelines
PseudoLocalize.Tests
PseudoLocalize
PseudoLocalizer.Core.Tests
PseudoLocalizer.Core
PseudoLocalizer.Humanizer
.gitattributes
.gitignore
Build.ps1
Directory.Build.props
LICENSE
PseudoLocalizer.nunit
PseudoLocalizer.sln
PseudoLocalizer.snk
README.md
Settings.StyleCop
build.sh
global.json

README.md

Pseudolocalizer

NuGet

Build Status

Build history

Introduction

Pseudolocalizer is a .NET Core Global Tool for testing internationalization aspects of software. Specifically, it reads string values from resource files in the resx or XLIFF format and generates fake translations for the "qps-Ploc" pseudo-locale (MSDN).

The tool is run from the command line and provides the following options for the fake translation:

  • Add accents on all letters so that non-localized text can be spotted - but without making the text unreadable.
  • Make all words 30% longer, to ensure that there is room for translations.
  • Add brackets to show the start and end of each localized string. This makes it possible to spot strings that have been cut off.
  • Reverse all words ("mirror"), to simulate right-to-left locales.
  • Replace all characters with underscores so that non-localized text can be spotted.

See also

Installation

To install the tool from NuGet using the .NET SDK run:

dotnet tool install --global PseudoLocalize

Usage

Usage: pseudo-localize [/l] [/a] [/b] [/m] [/u] [/c culture] file [file...]
Generates pseudo-localized versions of the specified input file(s).

The input files must be resource files in Resx or Xlf file format.
The output will be written to a file next to the original, with .qps-Ploc
(or the output culture you specify) appended to its name. For example, if
the input file is X:\Foo\Bar.resx, then the output file will be
X:\Foo\Bar.qps-Ploc.resx.

Options:
  /h, --help         Show command line help.
  /v, --version      Show the version of the tool.
  /l, --lengthen     Make all words 30% longer, to ensure that there is room for translations.
  /a, --accents      Add accents on all letters so that non-localized text can be spotted.
  /b, --brackets     Add brackets to show the start and end of each localized string.
                     This makes it possible to spot cut off strings.
  /m, --mirror       Reverse all words ("mirror").
  /u, --underscores  Replace all characters with underscores.
  /c, --culture      Use the following string as the culture code in the output file name(s).
  /o, --overwrite    Overwrites the input file(s) with the pseudo-localized version.
  /f, --force        Suppresses the confirmation prompt for the --overwrite option.

The default options, if none are given, are: /l /a /b.

Library

The core functionality is also available as a NuGet package, as well as a NuGet package that plugs into the Humanizer library.

These allow you to programmatically pseudo-localize strings for other scenarios not catered for by the PseudoLocalize tool itself.

Took at look at the source code for PseudoLocalize for examples of how to use the library to pseudo-localize strings and process streams.

Packages Latest Version
PseudoLocalizer.Core NuGet
PseudoLocalizer.Humanizer NuGet

Installation

dotnet add package PseudoLocalizer.Core
dotnet add package PseudoLocalizer.Humanizer

Usage with Humanizer

To register pseudo-localization for Humanizer, add the following snippet to your application:

new PseudoLocalizer.Humanizer.PseudoHumanizer().Register();

Feedback

Any feedback or issues can be added to the issues for this project in GitHub.

Repository

The repository is hosted in GitHub: https://github.com/martincostello/Pseudolocalizer.git

License

This project is licensed under the MIT license.

Building and Testing

Compiling the tool yourself requires Git and the .NET Core SDK to be installed.

To build and test the tool locally from a terminal/command-line, run one of the following set of commands:

Windows

git clone https://github.com/martincostello/Pseudolocalizer.git
cd Pseudolocalizer
.\Build.ps1

Linux/macOS

git clone https://github.com/martincostello/Pseudolocalizer.git
cd Pseudolocalizer
./build.sh