Add support for Transifex localizations #175

merged 11 commits into from Jan 29, 2013


None yet

2 participants


Check it out, yo! See the section on localization in the README for more info:

toolness added some commits Jan 23, 2013
@toolness toolness Added 'plist' command to bin/build-i18n.js and tests.
This command outputs a plist file for the given i18n bundle module.

Transifex doesn't currently support requirejs i18n bundles, and the
Apple plist format appears to be the closest thing to it.
@toolness toolness Added config.githubBranch to require config, made github URLs more DRY. 0557d05
@toolness toolness Added a very early bin/transifex.js and test suite.
The script doesn't really do anything yet other	than display some
information about the project.

Also added request as a dependency to package.json, as we use it to
communicate with transifex's REST API.
@toolness toolness added more functions to transifex.js with tests. b816f38
@toolness toolness wrote network-side part of importing from transifex. 6d0bc6a
@toolness toolness finished initial implementation of transifex.js. 046dc39
@toolness toolness added examples/transifex.html and instructions for localization to re…
@toolness toolness Added --i18n-url option to build-require.js. 405f4dd
@toolness toolness transifex.html now optionally uses transifex-to-requirejs-i18n-server.
This makes it easy for folks to test out their localization in Friendlycode
without needing to clone the git repo.

Code for the server is at Eventually I should probably make a proper node package that combines the server and the Transifex-related code in this branch.

@stenington stenington and 1 other commented on an outdated diff Jan 28, 2013
fs.readdirSync(templateDir).forEach(function(filename) {
var content = fs.readFileSync(templateDir + '/' + filename, 'utf8');
var defaultValues = InlineL10n.parse(content);
for (var key in defaultValues) {
var value = defaultValues[key];
+ var githubUrl = config.githubUrl + '/blob/' + config.githubBranch +
stenington Jan 28, 2013 Contributor

I wonder if it's worth mentioning something about the githubUrl and githubBranch configuration settings in the README? Maybe they're not going to need to be changed often enough to matter though. It seems like you'd only change them if you were localizing a fork with a different set of strings.

toolness Jan 29, 2013 Contributor

Yeah, this is a bit wonky to me... ideally I think that build-i18n.js would introspect into the .git directory to discover this information, to avoid the need for these variables in the first place, but there are lots of weird edge cases involved in that.

But wait! Another way to do this might be to use the repository property in package.json, and poke at that. It's a far more appropriate location for the information than require-config.js!

toolness Jan 29, 2013 Contributor

Ok, I moved the github-related config information to package.json in 8e970e9.

stenington Jan 29, 2013 Contributor

Ah, cool. package.json does feel more appropriate.

@stenington stenington commented on an outdated diff Jan 28, 2013
+ <head>
+ <meta charset="utf-8">
+ <base target="_blank">
+ <title>Friendlycode Editor with Transifex Localization</title>
+ <link rel="stylesheet" href="../css/friendlycode.css">
+ </head>
+ <body style="margin: 0">
+ <div id="bare-fc-holder" class="friendlycode-loading"></div>
+ <script src="../js/require-config.js"></script>
+ <script>
+ // We need to change the requirejs configuration to redirect
+ // all i18n bundles to transifex.
+ ['fc/nls', 'slowparse-errors/nls'].forEach(function(i18nBundle) {
+ var baseUrl = "";
stenington Jan 28, 2013 Contributor

Maybe it's worth putting a link to the gist with the server code in a comment in here? Again if someone is working on a fork and wants this file to work for their fork, they'd need to change this url to point to a similar service but with their own localizations, right?


Nice! The README seems accurate to me, and is pretty clear on how to work with Transifex to localize friendlycode. It seems like things get potentially a little confusing if someone wants to fork friendlycode, and then localize that as a separate Transifex project, but I don't think that's a major use case.

This seems great to me!

toolness added some commits Jan 29, 2013
@toolness toolness added locale selection widget and querystring arg to examples/transif…
@toolness toolness Moved github-related keys from require-config.js to package.json.
I tried to use the "repository" key in package.json described here:

The use of 'repository.defaultBranch' is my own invention, though,
which is hopefully acceptable.

The language dropdown is nice! Setting languages in the browser can be a bit clunky.

@toolness toolness merged commit ad9c3e9 into mozilla:gh-pages Jan 29, 2013

1 check passed

default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment