Giter Site home page Giter Site logo

resxswapper's Introduction

ResxSwapper

Utility for swapping the neutral language of a WinForms project with one of the already translated languages.

General

This command line utility is intended for C# / WinForms developers who want to swap the neutral language of their application with values from an already existing translation.

The Problem

You have an existing project that you may have started locally, in your native language and over time you went international. In my case I started with German with one of my projects. When the project got friction I soon regretted not to have started with English. I had an English translation e.g. FormMain.en.resx but if the app was started in an environment where no direct translation was avaiable (e.g. Russian) the app would fall back to German.

This is because, if the runtime does not find a matching translation, e.g. FormMain.ru.resx, it will fall back to the neutral cultured which strings are defined in FormMain.resx.

Of course during runtime, the values will not be read from the satellite assemblies and not the resource files, but let's stick with the analogy for the explanation of the problem.

What to do about it

There are things like Thread.CurrentCulture, but these are only workarounds to the basic problem: You've chosen the wrong neutral culture. In fact, there may only be two cultures world wide which I'd consider as neutral: English and Chinese. As soon as you have an international audience you should decide for one of the two.

So, given the example of a WinForm FormMain which neutral language is de and a given translation en, what you want to do is:

  1. Create a new FormMain.de.resx
  2. Copy all German resource values from FormMain.resx to FormMain.de.resx
  3. Copy all English resource values from FormMain.en.resx to FormMain.resx
  4. Move FormMain.en.resx to recycle bin

Now the neutral language will be English and you have a German translation.

What this utility does

There are tons (hundreds in my case) of Forms and Message files that I would need to swap. Visual Studio does not help you with this particular problem.

Basically the current version does what is proposed on the above list, with one exception: To determine the list of values to export from the neutral to the new satellite translation (e.g. de), only the translated values (e.g. en) are evaluated. This is mainly done because I did not want to dig too deep into resx handling. So, only values that are translated on your new neutral language will be swapped. So be sure that the translation is complete. Otherwise some old values will stay in the neutral resx file and to be adjusted manually. This could be improved in the future.

Usage

Please refer to the source code to get an idea. An expierienced developer will unterstand easily what this tool does. I think the tool is not tested enough to provide a manual for non-developers yet. This may be added in the future.

resxswapper's People

Contributors

oblakhh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.