Code Monkey home page Code Monkey logo

manage-translations-json's Introduction

Manage translations

A spreadsheet and macro for app developers to manage translations more easily. Keep track of the list of captions and label texts, have translators or your users translate the texts, and finally use a macro to generate the source files used in your project.

It contains a VBA and LibreOffice script that outputs the .json, .xml, .strings or .resx files which can be used in JavaScript, Eclipse, XCode or Visual Studio. Includes examples for both MS-Excel and LibreOffice Calc.

preview screenshot

How to use

To use this sheet for your project, first add all labels you need for your app in column A. To keep the sheet structured, you can use empty rows or comment rows starting with double slash (//). You can also change or add columns to add more translations.

Hire a translator or have your superusers make the necessary translations. When all the translations are ready, you can generate the JSON, Eclipse XML files, the XCode .strings files or the Visual Studio resource .resx files. Press ALT+F8 and run one of the following macro's:

GenerateLocalisationJson
GenerateLocalisationEclipse
GenerateLocalisationVisualStudio
GenerateLocalisationXcode

The macros will create a folder called "json" or "xcode" or "eclipse" or "visualstudio" in the same folder where the spreadsheet file is located. Visual Studio .resx output is untested, the files might need some tweaking.

Sheet content

Column A contains the keys you will use in your code. These are the keys for NSLocalizedString in XCode, or the string ID's in Eclipse. Column B and further contain the actual translations which you can display somewhere in your app.

The first 4 rows contain information about each translation. Language code is a ISO 639-1 code, a two letter code for the language. For example es for Spanish, see full ISO 639-1 list

The displayname and translator cells only serve for comment/credits purposes. The cell colors are for display only, the macro doesn't use them.

Export preview

The macro can export to different formats, here is a preview of the output.

JavaScript JSON files

{
	"en": {
		"Start": "Start game",
		"Editor": "Editor",
		..etc

XCode Localization.strings files

// menu items
"Start" = "Start game";
"Editor" = "Editor";
..etc

Eclipse string.xml files

<?xml version="1.0" encoding="utf-8"?>
<resources>
	<!-- menu items -->
	<string name="start">Start game</string>
	<string name="editor">Editor</string>
	..etc

Visual Studio .resx files export (untested)

<?xml version="1.0" encoding="utf-8"?>
<root>
	<!-- menu items -->
	<data name="start">
		<value>Start game</value>
	</data>
	<data name="editor">
		<value>Editor</value>
	</data>
	..etc

Questions

  • Why use a spreadsheet when there are translation services?

While app localization services can work for large scale projects, for most small to medium sized apps it doesn't make a lot of sense. Unless you're constantly adding content and adding new texts to be translated, you would be paying a monthly fee for a service that basically stores a list of words.

  • Why not just use automatic tanslations like Google Translate?

Automatic translations can give pretty impressive results, but translation errors are still very common. For text labels and captions in an app the probability of errors is even higher, because they're typically short texts without any context. As a real world example of translations errors, in an industrial machinery app the English label Running time installation was automatically translated to Russian as basically "Duration of the theater show", and in a retail inventory report Stock shift was automatically translated to "Stock shares moved".

  • Why not just query an online translations API at run-time?

Besides the translation errors, this adds a lot of complexity; Do you require the user to be always-online? Do you initially cache the translation results? What if the translation server is temporarily offline? This requires a disproportionate amount of effort for what is essentially a static list of phrases and words.

Questions, comments - Bas de Reuver [email protected]

manage-translations-json's People

Contributors

bdr76 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.