Skip to content

Commit

Permalink
Merged in JulianKniephoff/annotation-tool/i29/ui-translation (pull re…
Browse files Browse the repository at this point in the history
…quest #21)

First big push towards UI translation
  • Loading branch information
JulianKniephoff authored and rrolf committed Aug 8, 2017
2 parents f539859 + f59cb31 commit e1275f6
Show file tree
Hide file tree
Showing 58 changed files with 14,480 additions and 335 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ opencast-backend/annotation-tool/src/main/resources/ui/
# Sometimes they help, but they should never be tracked
Makefile
/frontend/www

# Ignore translation file backups
/frontend/locales/**/*_old.json
48 changes: 40 additions & 8 deletions frontend/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ module.exports = function (grunt) {
html : '**/*.html',
tmpl : 'templates/*.tmpl',
tests : 'tests/',
www : '<%= webServerDir %>/**/*'
www : '<%= webServerDir %>/**/*',
locales : 'locales/**/*.json'
},

profiles: {
Expand Down Expand Up @@ -101,6 +102,10 @@ module.exports = function (grunt) {
files: ['<%= srcPath.less %>', '<%= srcPath.js %>', '<%= srcPath.html %>', '<%= srcPath.tmpl %>'],
tasks: ['copy:target']
},
locales: {
files: ['<%= srcPath.locales %>'],
tasks: ['copy:locales']
},
// Watch file on web server for live reload
www: {
options: {
Expand Down Expand Up @@ -265,6 +270,14 @@ module.exports = function (grunt) {
'config': {
src: '<%= currentProfile.config %>',
dest: '<%= currentProfile.target %>/js/annotations-tool-configuration.js'
},
// ... the translations
'locales': {
files: [{
src: '<%= srcPath.locales %>',
dest: '<%= currentProfile.target %>',
expand: true
}]
}
},

Expand Down Expand Up @@ -296,10 +309,10 @@ module.exports = function (grunt) {
/** Task to run tasks in parrallel */
concurrent: {
dev: {
tasks: ['watch:js', 'watch:html', 'watch:less', 'watch:templates', 'watch:www', 'connect:dev'],
tasks: ['watch:js', 'watch:html', 'watch:less', 'watch:templates', 'watch:locales', 'watch:www', 'connect:dev'],
options: {
logConcurrentOutput: true,
limit: 6
limit: 7
}
}
},
Expand Down Expand Up @@ -356,6 +369,7 @@ module.exports = function (grunt) {
preserveLicenseComments : false,
optimize : 'uglify',
useStrict : true,
findNestedDependencies : true,
out : '<%= currentProfile.target %>/optimized.js'
}
}
Expand All @@ -367,6 +381,23 @@ module.exports = function (grunt) {
create: ['<%= currentProfile.target %>']
}
}
},

gulp: {
i18next: function () {
const gulp = require('gulp');
const i18next = require('i18next-parser');
return gulp.src([
'index.html',
grunt.config.get('srcPath.js'),
grunt.config.get('srcPath.tmpl'),
'!js/libs/**/*',
'!js/handlebarsHelpers.js'
]).pipe(i18next({
locales: ['en', 'de'],
ignoreVariables: true
})).pipe(gulp.dest('locales'));
}
}
});

Expand All @@ -382,6 +413,7 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-mkdir');
grunt.loadNpmTasks('grunt-gulp');
grunt.loadNpmTasks('assemble-less');


Expand All @@ -391,12 +423,12 @@ module.exports = function (grunt) {

// Default task
grunt.registerTask('default', ['jshint:all', 'less', 'copy:local-all', 'copy:local-index']);
grunt.registerTask('baseDEV', ['handlebars:all', 'less', 'copy:all', 'processhtml:dev', 'copy:less', 'copy:config', 'concurrent:dev']);
grunt.registerTask('baseDEMO', ['mkdir:demo', 'handlebars:all', 'less', 'copy:demo', 'processhtml:dev', 'copy:config']);
grunt.registerTask('baseDEV', ['handlebars:all', 'less', 'copy:all', 'processhtml:dev', 'copy:less', 'copy:config', 'copy:locales', 'concurrent:dev']);
grunt.registerTask('baseDEMO', ['mkdir:demo', 'handlebars:all', 'less', 'copy:demo', 'processhtml:dev', 'copy:config', 'copy:locales']);
//grunt.registerTask('baseBUILD', ['blanket_qunit', 'jsdoc', 'less', 'copy:build', 'processhtml:build', 'copy:config', 'requirejs']);
grunt.registerTask('baseBUILD', [/*'blanket_qunit', */'jsdoc', 'handlebars:temp', 'less', 'copy:build', 'processhtml:build', 'copy:config', 'requirejs']);
grunt.registerTask('baseINTEGRATION', ['handlebars:all', 'less', 'copy:integration', 'processhtml:dev', 'copy:config']);
grunt.registerTask('baseINTEGRATIONMINIFIED', ['blanket_qunit', 'handlebars:temp', 'less', 'copy:integration', 'processhtml:build', 'copy:config', 'requirejs']);
grunt.registerTask('baseBUILD', [/*'blanket_qunit', */'jsdoc', 'handlebars:temp', 'less', 'copy:build', 'processhtml:build', 'copy:config', 'copy:locales', 'requirejs']);
grunt.registerTask('baseINTEGRATION', ['handlebars:all', 'less', 'copy:integration', 'processhtml:dev', 'copy:config', 'copy:locales']);
grunt.registerTask('baseINTEGRATIONMINIFIED', ['blanket_qunit', 'handlebars:temp', 'less', 'copy:integration', 'processhtml:build', 'copy:config', 'copy:locales', 'requirejs']);

grunt.registerTaskWithProfile = function (name, description, defaultProfile) {
grunt.registerTask(name, description, function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
* @module annotations-tool-configuration
*/
define(["jquery",
"moment",
"underscore",
"roles",
"player_adapter_HTML5"
// Add here the files (PlayerAdapter, ...) required for your configuration
],

function ($, _, ROLES, HTML5PlayerAdapter) {
function ($, moment, _, ROLES, HTML5PlayerAdapter) {

"use strict";

Expand Down Expand Up @@ -140,23 +141,6 @@ define(["jquery",

tracksToImport: undefined,

/**
* Formats the given date in
* @alias module:annotations-tool-configuration.Configuration.formatDate
* @type {module:player-adapter.formatDate}
*/
formatDate: function (date) {
if (_.isNumber(date)) {
date = new Date(date);
}

if (_.isDate(date)) {
return date.getDate() + "." + (date.getMonth() + 1) + "." + date.getFullYear();
} else {
return "Unvalid date";
}
},

/**
* Get the tool layout configuration
* @return {object} The tool layout configuration
Expand Down
17 changes: 0 additions & 17 deletions frontend/build/profiles/local/annotations-tool-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,6 @@ define(["jquery",
*/
tracksToImport: undefined,

/**
* Formats the given date in
* @alias module:annotations-tool-configuration.Configuration.formatDate
* @type {module:player-adapter.formatDate}
*/
formatDate: function (date) {
if (_.isNumber(date)) {
date = new Date(date);
}

if (_.isDate(date)) {
return date.getDate() + "." + (date.getMonth() + 1) + "." + date.getFullYear();
} else {
return "Unvalid date";
}
},

/**
* Get the tool layout configuration
* @return {object} The tool layout configuration
Expand Down
83 changes: 41 additions & 42 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Annotating Academic Video</title>
<meta name="description" content="Video annotations tool">
<title data-i18n="title">Annotating Academic Video</title>
<meta name="description" data-i18n="[content]description" content="Video annotations tool">
<meta name="author" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="style/style.css">
Expand All @@ -34,20 +34,20 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a id="video-title" class="brand" href="#">Annotating Academic video - <%= version %> </a>
<a id="video-title" class="brand" href="#"><span data-i18n="title"></span> - <%= version %> </a>

<ul class="nav pull-right">
<li><a href="#" id="about">About</a></li>
<li><a href="#" id="about" data-i18n="menu.about"></a></li>
<li class="dropdown" id="view-options">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">View <b class="caret"></b></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span data-i18n="menu.view.head"></span> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="menu-category">Annotate</li>
<li><a id="opt-annotate-text" class="opt-layout checked" href="#"><i class="check icon-check"></i> Text annotations</a></li>
<li><a id="opt-annotate-categories" class="opt-layout checked" href="#"><i class="check icon-check"></i> Structured annotations</a></li>
<li class="menu-category" data-i18n="menu.view.annotate.head"></li>
<li><a id="opt-annotate-text" class="opt-layout checked" href="#"><i class="check icon-check"></i> <span data-i18n="menu.view.annotate.text annotations"></span></a></li>
<li><a id="opt-annotate-categories" class="opt-layout checked" href="#"><i class="check icon-check"></i> <span data-i18n="menu.view.annotate.structured annotations"></span></a></li>
<li role="presentation" class="divider"></li>
<li class="menu-category">Views</li>
<li><a id="opt-view-annotate" class="opt-layout checked" href="#"><i class="check icon-check"></i> Annotate view</a></li>
<li><a id="opt-view-list" class="opt-layout checked" href="#"><i class="check icon-check"></i> List view</a></li>
<li class="menu-category" data-i18n="menu.view.views.head"></li>
<li><a id="opt-view-annotate" class="opt-layout checked" href="#"><i class="check icon-check"></i> <span data-i18n="menu.view.views.annotate view"></span></a></li>
<li><a id="opt-view-list" class="opt-layout checked" href="#"><i class="check icon-check"></i> <span data-i18n="menu.view.views.list view"></span></a></li>
<li role="presentation" class="divider"></li>

<li>
Expand All @@ -57,17 +57,17 @@
</li>

<li role="presentation" class="divider"></li>
<li class="menu-category">Annotations visibility</li>
<li><a class="opt-tracks-mine" href="#"><i class="check icon-check"></i> My annotations only</a></li>
<li><a class="opt-tracks-select" href="#"><i class="check icon-check"></i> Other public annotations...</a></li>
<li><a class="opt-tracks-public" href="#"><i class="check icon-check"></i> All public annotations</a></li>
<li class="menu-category" data-i18n="menu.view.annotation visibility.head"></li>
<li><a class="opt-tracks-mine" href="#"><i class="check icon-check"></i> <span data-i18n="menu.view.annotation visibility.only mine"></span></a></li>
<li><a class="opt-tracks-select" href="#"><i class="check icon-check"></i> <span data-i18n="menu.view.annotation visibility.other public"></span></a></li>
<li><a class="opt-tracks-public" href="#"><i class="check icon-check"></i> <span data-i18n="menu.view.annotation visibility.all public"></span></a></li>


</ul>
</li>
<li><a href="#" id="export">Export for statistics</a></li>
<li><a href="#" id="print">Print</a></li>
<li><a href="#" id="logout">Logout</a></li>
<li><a href="#" id="export" data-i18n="menu.export"></a></li>
<li><a href="#" id="print" data-i18n="menu.print"></a></li>
<li><a href="#" id="logout" data-i18n="menu.logout"></a></li>
</ul>
</div>
</div>
Expand All @@ -77,8 +77,8 @@

<!-- Loading box -->
<div class="hero-unit" id="loading">
<h1>Loading</h1>
<p class='info'>The annotations tool create the views</p>
<h1 data-i18n="startup.loading"></h1>
<p class='info' data-i18n="startup.creating views"></p>
<p>
<div class="progress progress-striped active">
<div class="bar" style="width: 10%;"></div>
Expand Down Expand Up @@ -115,19 +115,19 @@ <h1>Loading</h1>
<div class="btn-group dropup">
<!-- <button class="btn">Other annotations</button> -->
<button class="btn dropdown-toggle" data-toggle="dropdown">
Other annotations <span class="caret"></span>
<span data-i18n="timeline.other annotations.head"></span> <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a class="opt-tracks-mine" href="#"><i class="check icon-check"></i> My annotations only</a></li>
<li><a class="opt-tracks-select" href="#"><i class="check icon-check"></i> Other public annotations...</a></li>
<li><a class="opt-tracks-public" href="#"><i class="check icon-check"></i> All public annotations</a></li>
<li><a class="opt-tracks-mine" href="#"><i class="check icon-check"></i> <span data-i18n="timeline.other annotations.only mine"></span></a></li>
<li><a class="opt-tracks-select" href="#"><i class="check icon-check"></i> <span data-i18n="timeline.other annotations.other public"></span></a></li>
<li><a class="opt-tracks-public" href="#"><i class="check icon-check"></i> <span data-i18n="timeline.other annotations.all public"></span></a></li>
</ul>
</div>
<a id="add-track" class="btn">+ Add track</a>
<a id="add-track" class="btn">+ <span data-i18n="timeline.add track.button"></span></a>
</div>


<div class="timeline-bottom-controls" id="reset-zoom"><a class="btn"><i class="icon-eye-open"></i> Reset zoom</a></div>
<div class="timeline-bottom-controls" id="reset-zoom"><a class="btn"><i class="icon-eye-open"></i> <span data-i18n="timeline.reset zoom"></span></a></div>
<div class="timeline-bottom-controls" id="move-left"><a class="btn">&lt;</a></div>
<div class="timeline-bottom-controls" id="zoom-in"><a class="btn">+</a></div>
<div class="timeline-bottom-controls" id="zoom-out"><a class="btn">-</a></div>
Expand All @@ -145,28 +145,27 @@ <h1>Loading</h1>
<div class="window expanded" id="annotate-container" style="display:none">

<div class="navbar">
<div class="navbar-inner">
<div class="container">
<span class="window-title">Annotate</span>
<span class="title">on</span>
<span class='currentTrack'>
<span class="content"></span>
</span>
</div>
<div class="navbar-inner">
<div class="container">
<span class="window-title" data-i18n="annotate on"></span>
<span class='currentTrack'>
<span class="content" data-i18n="annotate.no selected track"></span>
</span>
</div>
</div>
</div>

<div class="control-group" id="annotate-form">
<div class="no-track">Select a track to start annotating</div>
<div class="no-track" data-i18n="annotate.select track prompt"></div>

<div id="input-container" class="insert-fields">
<textarea id="new-annotation" placeholder="Write a free text annotation. Use &raquo;shift + return&laquo; keys to create a new line." rows="3" title="Use &raquo;shift + return&laquo; keys to create a new line."></textarea>
<textarea id="new-annotation" data-i18n="[placeholder]annotate.new.placeholder;[title]annotate.new.title" rows="3"></textarea>
<div class="controls stop-fields">
<label class="checkbox inline">
<input id="pause-video" type="checkbox">Pause video during writing
<input id="pause-video" type="checkbox"> <span data-i18n="annotate.pause while editing"></span>
</label>
</div>
<button id="insert" type="button" class="btn">Insert</button>
<button id="insert" type="button" class="btn" data-i18n="annotate.insert"></button>
</div>


Expand All @@ -175,7 +174,7 @@ <h1>Loading</h1>

<ul class="nav nav-tabs" id="label-tabs-buttons">
<label class="checkbox inline" id="editSwitch">
<input type="checkbox" value="option1"> Edit mode
<input type="checkbox" value="option1"> <span data-i18n="annotate.edit mode"></span>
</label>
</ul>

Expand All @@ -198,10 +197,10 @@ <h1>Loading</h1>

<ul class="nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Items visiblity<b class="caret"></b></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span data-i18n="annotate.items visibility.head"></span><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#" class="collapse-all">Collapse All</a></i></li>
<li><a href="#" class="expand-all">Expand All</a></i></li>
<li><a href="#" class="collapse-all" data-i18n="annotate.items visibility.collapse all"></a></i></li>
<li><a href="#" class="expand-all" data-i18n="annotate.items visibility.expand all"></a></i></li>
</ul>
</li>
</ul>
Expand Down

0 comments on commit e1275f6

Please sign in to comment.