Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslevesque committed Nov 26, 2018
1 parent 29430db commit 7c58771
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ Console.WriteLine("The size of '{0}' is {1}", f, formatter.Format(f.Length));
Localization
------------

At this stage, HumanBytes only supports English and French. However, if you need support for another language, it's very easy: there are only 3 terms that need to be translated, so it shouldn't take more than a minute. Here are the steps:
At this stage, HumanBytes only supports English and French. However, if you need support for another language, it's very easy, as there are only 3 terms that need to be translated. Just create an instance of `ByteSizeFormatter` as shown above, and set the following properties:

- add a `Resources.xx.resx` file (where `xx` is the language code) in the `HumanBytes/Properties` folder, and translate the terms
- edit `HumanBytes/HumanBytes.csproj` to include the new resource file
- edit `NuGet\HumanBytes.nuspec` to include the new satellite assembly
- `ByteSymbol`: the symbol for byte, e.g. "B" in English.
- `ByteWord`: the word for byte, e.g. "byte" in English.
- `ByteWords`: the word for several bytes, e.g. "bytes" in English.

The values set on these properties will be used instead of the ones defined in resources.

If you would like to add permanent support for another language, you'll have to modify the library itself. Just clone the project, add a `Resources.xx.resx` file (where `xx` is the language code) in the `HumanBytes/Properties` folder, translate the terms, and build.

I'll be glad to accept pull requests to support more languages.

0 comments on commit 7c58771

Please # to comment.