OBS localization - organization of work

Corwin

New Member
Hello! I am someone who translates the program into russian. I ran into a little problem. I am a bit uncomfortable doing this work. I have to find a new line of software interface and then add russian localization to ru.txt. Compare two txt file (en.txt and ru.txt) - which is too long.

I am proposing to organize an online platform for translators. For example, here I am helping a German developer:

This is a simple table of Google Docs. Author of the document adds a new line - then the translators fill their units.
What are your suggestions?
 

micechal

Member
I like your idea. Right now, it's very hard to track changes made to the localization files. There are some free Content Management Systems about keeping it easy. Maybe Warchamp7 could create a subpage on the obsproject.com site so we can change it more easily :)
 

Muf

Forum Moderator
A spreadsheet isn't a bad idea. You can export to a CSV file (maybe with something other than a comma as a separating value - not sure if Google Drive allows this), and then have a shell script of some kind turn them into locale files.
 

micechal

Member
Maybe you could use something like Pootle? This one is advanced, but maybe there is something lighter, for projects with less files to translate :)
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Okay, listen. I need someone's help with this. I will always add translation files people send me, but hypothetical situation here: let's say we used a spreadsheet, there are 20 new translation items, and there are countless languages to go through. Let's say 10 languages. That's 200 items across 10 files. People add it onto the spreadsheet.. that's great, but how would they get it off the spreadsheet and into the translation files? We can't just copy and paste each new item for each new language one by one. I am -not- going to do that. I don't have time. There would have to be some sort of tool to convert it to translation files, but I just do not have time to do that right now.

I seriously have so many things I have to do and it's admittedly frustrating. Translators themselves currently can access github and do pull requests literally any time and they will be merged into the project with a simple press of a button, and they can send the new translation files to me and I will upload them directly as well. But other than that, I don't know what to do. I know you guys need help, but please help me too. I need to be in the code, not digging inside the translation files. What am I supposed to do?
 

R1CH

Forum Admin
Developer
I feel like a web based system would work well. Pulls strings to be translated automatically from the latest git and such and outputs in the exact format needed.
 

pystub

New Member
You can use Python, for example (only one of the options). I think even some JavaScript can be used to extract the translation file straight from the GDocs. I'll try to come up with something real quick.

Edit: So Google Docs helpfully removes the invisible rows from the HTML. JS approach kind of goes out the window, because it will take some time to make it really automated
Code:
var someExporter = {}; //don't litter the global scope!
someExporter.table = document.getElementById ('0-grid-table-quadrantscrollable');
someExporter.tbody = null;
for (var i = 0; i < someExporter.table.childNodes.length; i++) {
    if (someExporter.table.childNodes[i].nodeName == 'TBODY') {
        someExporter.tbody = someExporter.table.childNodes[i];
        break;
    }
}
if (!someExporter.tbody)
    throw new Error ('there is no body!');
for (var i = 7; i < someExporter.tbody.childNodes.length; i++) {
    console.log (
        someExporter.tbody.childNodes[i].childNodes[1].innerHTML +
        "\t" +
        someExporter.tbody.childNodes[i].childNodes[3].innerHTML
    );
}
 

pystub

New Member
Here is some Python, Tested with version 3.3
Code:
import csv
import re

with open ('Sheet1.csv') as f:
	reader = csv.reader (f)

	langRe = re.compile (r'^([A-Za-z]{2})\b.*') # here we control what in the first row triggers generation of a translation and what it will be named
	translations = []
	columnIndex = 0
	for column in next (reader): # pick the first row and run through every cell
		result = langRe.search (column)
		if result:
			lang = result.group (1)
			translations.append ({'file': open ('{0}.txt'.format(lang), 'w'), 'index': columnIndex})
		columnIndex += 1

	for row in reader: # section to discard comment rows. should be possible to merge to main loop, but this makes it more clear... i think
		haveAll = True
		for t in translations:
			if row[t['index']] == '':
				haveAll = False
		if haveAll:
			break

	for row in reader:
		for t in translations:
			if row[0] == '':
				t['file'].write ('\n')
			else:
				t['file'].write ("{0}\t{1}\n".format (row[0], row[t['index']]))
Save it in a, let's say, "convert.py" next to the csv which you should name "Sheet1.csv".

Of course, this does imply that you have to download the csv from the Google Drive every time, but it should help some. I'm still trying to wrap my head around the Google's API
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Corwin pointed me here the other day though I haven't really had time to give it a good look over.. I might just have to make an application to make this easier for users and make it use git/github so users can make pull requests and update the repository directly
 

dodgepong

Administrator
Forum Admin
I created a CrowdIn project here: http://crowdin.net/project/obsproject

I haven't uploaded all the strings from all the existing localizations yet (I believe German, Swedish, and Spanish are the only ones I've uploaded all the existing strings for), but after playing with CrowdIn last night, I think it's definitely the way to go. It shows how complete each translation is, and gives an easy interface for translators to translate each string without having to know how the resulting locale file is formatted. It lets translators discuss each translastion if they have questions, and lets you set up a glossary of terms to define words more clearly to help in translating them. It has a nice, simple proofreading process with varying levels of permissions (translator, proofreader, and manager) and it is trivial to add more languages to translate into. Also, I got it approved as an Open Source project, to it is free for unlimited use!

The only downside is that it requires us to change the format of the locale file from
Identifier "translation"
to
Identifier="translation"
and change the extension from .txt to .ini. (Basically convert the locale file into an INI and use INI format)

Personally, I think it's worth it, but it's up to the translators and Jim. So let me know what you think!
 

dodgepong

Administrator
Forum Admin
ColterTV brought up a good point in IRC that sometimes the word is not enough to know how to translate it; sometimes you need context. For example, there is a string called "Order" in the main application file, with the identifier "Order". It's hard to know what that means just by looking at it.

CrowdIn has a feature that lets you tag each string with a "context", which lets you give a brief explanation of how that word is used. Then we could say the context for "Order" is that it's the menu item that lets you select how to order sources, not an Order as in a command, and not as in a request to purchase something.

There are 2 ways I can see to do this: we can either include the context in the locale file itself and make the file a CSV (Identifier,"translation",Context), or edit Contexts on CrowdIn itself as needed (and keep using the INI format) and keep Contexts out of the locale files.

My inclination would be to keep the INI files and just use CrowdIn to specify contexts as needed, but I'd liek to hear anyone else's opinions, too.
 

dodgepong

Administrator
Forum Admin
I have uploaded the Japanese, Greek, and Traditional Chinese localizations to CrowdIn. I'm not sure about the Chinese, though, since from what I can tell, "tw" is supposed to be used for the Twi language, according to ISO 639-1, but we seem to be using it for "Taiwan". I think this is a problem with using 2-letter language codes instead of 2-letter region codes, since Simplified Chinese is zh_CN and Traditional is zh_TW.

More discussion here: http://stackoverflow.com/questions/4892 ... al-chinese
 

ColterTV

Member
Awesome, I've been translating more strings for the spanish one, I think I'll have 100% soon, I'm missing some strings yet as I need to see their context
 

dodgepong

Administrator
Forum Admin
Oftentimes the Identifier can give a clue as to where you can find the string used in the program, so you might be able to use that to find where a string is used to understand the context.

Having said that, I would like to start compiling a list of tough strings to translate which would benefit from a more thorough explanation of context, and I can try to go through them and find where they are used and update CrowdIn with their context.

In other news, I have finished uploading the rest of the translations. As far as I can tell, everything that is in Github and OBS itself is now on CrowdIn, save for the HTML help files. I haven't yet decided if we want to bother putting those up...I suppose it couldn't hurt.
 

OrionRBR

New Member
Hey its nice to have the users to translate the program,i just finish the translation for brazilian portuguese today its just needs approval for the translations
 
Top