Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix readme and internationalize #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ results

npm-debug.log
.ep_initialized

config.json
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ It provides a way to do:

You will need to set the `requireSession` and `editOnly` values to `true` in etherpad's `settings.json` file.

It's recommended to also add in a `sessionKey`. This can be any random value, but should be the same across the cluster.

To get it working, change the `dbType` to `cassandra` and enter the following `dbSettings`:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this no longer recommended?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's now recommended to have a SESSIONKEY.txt file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I had it in the settings.json I got this deprecation warning:

[2015-06-10 09:21:46.175] [WARN] console - Declaring the sessionKey in the settings.json is deprecated. This value is auto-generated now. Please remove the setting from the file.


```javascript
"dbSettings" : {
"hosts": ["127.0.0.1:9160"],
"keyspace": "oae",
"cfName": "Etherpad",
"columnFamily": "Etherpad",
"user": "",
"pass": "",
"timeout": 3000,
"replication": 1,
"strategyClass": "SimpleStrategy"
"strategyClass": "SimpleStrategy",
"clientOptions": {
"keyspace": "oae",
"contactPoints": ["127.0.0.1"]
}
}
```

Expand All @@ -46,7 +48,7 @@ You should have the following structure (assuming you have etherpad at `/opt/eth
* index.json
* ep.json

Copy or symlink the `static/css/padd.css` file in this plugin to `your-etherpad-directory/src/static/custom/pad.css`. This file will skin the etherpad chrome. In order to have custom titles for headers, copy or symlink the `static/templates/editbarButtons.ejs` file in this plugin to `your-etherpad-directory/node_modules/ep_headings/templates/editbarButtons.ejs`.
Copy or symlink the `static/css/padd.css` file in this plugin to `your-etherpad-directory/src/static/custom/pad.css`. This file will skin the etherpad chrome.

In order to use the OAE toolbar, the etherpad `settings.json` file needs to be updated to reflect the following changes:

Expand Down
13 changes: 13 additions & 0 deletions locales/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ep_headings.code" : "Code",
"ep_headings.h1" : "Titel 1",
"ep_headings.h2" : "Titel 2",
"ep_headings.h3" : "Titel 3",
"ep_headings.h4" : "Titel 4",
"ep_headings.h5" : "Titel 5",
"ep_headings.h6" : "Titel 6",
"ep_headings.normal" : "Normal",
"ep_headings.style" : "Stil",
"ep_oae.download": "Download",
"ep_oae.togglecolors": "Schaltet die Urheber Farben"
}
13 changes: 13 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartf did you have a way in mind to sync this with crowdin? It would be preferential if the i18n keys could be part of the same project as 3akai-ux. I believe this could be done by adding a fourth location in 3akai-ux/tools/crowdin/crowdin.template that points to ep_oae's locales/en.json file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like those paths are relative to 3akai-ux though, and this source doesn't end up in there.

"ep_headings.code": "Code",
"ep_headings.normal": "Normal",
"ep_headings.style": "Style",
"ep_headings.h1": "Title 1",
"ep_headings.h2": "Title 2",
"ep_headings.h3": "Title 3",
"ep_headings.h4": "Title 4",
"ep_headings.h5": "Title 5",
"ep_headings.h6": "Title 6",
"ep_oae.download": "Download",
"ep_oae.togglecolors": "Toggle authorship colors"
}
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
"dependencies": {
"amqp": "git://github.com/oaeproject/node-amqp#0.1.8.x"
},
"devDependencies": {
"crowdin": "latest",
"mv": "latest",
"temp": "latest",
"underscore": "latest"
},
"engines": {
"node": ">= 0.8.0"
}
Expand Down
4 changes: 2 additions & 2 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ exports.postAceInit = function (hook_name, args, cb) {
$('.buttonicon-showusers').removeClass('buttonicon-showusers').addClass('buttonicon-oae buttonicon-user');

// Add extra buttons to the toolbar *after* the style select
$('ul.menu_left').append('<li data-type="button" data-key="colorcheck"><a class="grouped-left" data-l10n-id="pad.settings.colorcheck" title="Toggle authorship colors"><button class="buttonicon buttonicon-oae buttonicon-clearauthorship"></button></a></li>');
$('ul.menu_left').append('<li data-type="button" data-key="download"><a target="_blank" href="' + window.location.pathname + '/export/pdf" class="grouped-right" data-l10n-id="pad.importExport.exportpdf" title="Download"><button class="buttonicon buttonicon-oae buttonicon-download"></button></a></li>');
$('ul.menu_left').append('<li data-type="button" data-key="colorcheck"><a class="grouped-left" data-l10n-id="pad.settings.colorcheck" title="' + window._('ep_oae.togglecolors') + '"><button class="buttonicon buttonicon-oae buttonicon-clearauthorship"></button></a></li>');
$('ul.menu_left').append('<li data-type="button" data-key="download"><a target="_blank" href="' + window.location.pathname + '/export/pdf" class="grouped-right" data-l10n-id="pad.importExport.exportpdf" title="' + window._('ep_oae.download') + '"><button class="buttonicon buttonicon-oae buttonicon-download"></button></a></li>');

// Show the toolbar
$('.toolbar').animate({
Expand Down
14 changes: 0 additions & 14 deletions static/templates/editbarButtons.ejs

This file was deleted.

98 changes: 98 additions & 0 deletions tools/sync-translations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference would be to align this key synchronisation script a lot more with the 3akai-ux synchronisation script. I don't have a strong opinion about whether we use the crowdin JAR file or the node library, but I do think we should pick one that was use in both places to avoid having to maintain 2 completely different approaches. The 3akai-ux synchronisation script also does some things (e.g. removing empty translation files) which this should be doing.

@stuartf : What would be the best approach to aligning these more?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does remove the empty translation files.

I think the 3akai-ux sync script might be simplified by using the npm crowdin module, but there are differences in how the two projects handle translations so they can't just use the same script. I.E. 3akai-ux uses properties files and needs the manifest files updated with a list of translations, ep_oae uses json files and they all just live in the locales directory.

* Copyright 2013 Apereo Foundation (AF) Licensed under the
* Educational Community License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.osedu.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

var _ = require('underscore');
var config = require(__dirname + '/../config');
var Crowdin = require('crowdin');
var fs = require('fs');
var temp = require('temp');

// Automatically track and cleanup files at exit
temp.track();

var crowdin = new Crowdin(config.crowdin);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not using a config and just passing in the parameters through the command line, which is part of the alignment between our crowdin synchs. It's probably also not necessary to have certain things like the project id in the config file (as we will only ever have 1 crowdin project)


/**
* Make a POST request to crowdin
*
* @param {String} path The path to the crowdin api endpoint
* @param {Object} data The post data to be passed to request
* @param {Function} callback A function to call on completion
*/
var crowdinPost = function(path, data, callback) {
data.key = config.crowdin.apiKey;
crowdin.requestData({
uri: config.crowdin.endpointUrl + path,
method: 'POST',
formData: data,
qs: {
json: 'json'
}
}).then(callback);
};

/**
* Update the local translation files with data from crowdin
*/
var downloadCrowdinTranslations = function() {
console.log('Downloading translations');
temp.mkdir('crowdin', function(err, dirPath) {
// Download all the OAE translations
crowdin.downloadToPath(dirPath).then(function(){
// Copy the non-empty ep_oae bundles
fs.readdir(dirPath + '/locales', function(err, files) {
_.each(files, function(file) {
fs.readFile(dirPath + '/locales/' + file, function(err, data) {
var translations = JSON.parse(data);
var notEmpty = _.values(translations).some(function(translation){
return translation !== '';
});
if (notEmpty){
fs.createReadStream(dirPath + '/locales/' + file).pipe(fs.createWriteStream(__dirname + '/../locales/' + file));
}
});
});
});
});
});
};

// Upload keys
var keysPostData = {
"files[/ep_oae/locales/en.json]": fs.createReadStream(__dirname + '/../locales/en.json')
};
console.log('Uploading keys');
crowdinPost('/update-file', keysPostData, function() {
console.log('Uploading translations');
// Upload existing translations
fs.readdir(__dirname + '/../locales', function(err, files) {
// After all the translations are uploaded, download any changes
var done = _.after(files.length, downloadCrowdinTranslations);

_.each(files, function(file) {
// We don't upload translations for the source language, that's covered by the key upload
if (file !== 'en.json') {
var translationPostData = {
key: config.crowdin.apiKey,
"files[/ep_oae/locales/en.json]": fs.createReadStream(__dirname + '/../locales/' + file),
language: file.substring(0, 2)
};
crowdinPost('/upload-translation', translationPostData, done);
} else {
done();
}
});
});
});