Commit 51e2aaec authored by echel0n's avatar echel0n
Browse files

Finish i18n feature code

parent 78662821
......@@ -428,22 +428,51 @@ module.exports = function (grunt) {
grunt.task.run(tasks);
});
grunt.registerTask('update_trans', 'Update translations', function() {
grunt.log.writeln('Updating translations...'.magenta);
grunt.registerTask('upload_trans', 'Upload translations', function() {
grunt.log.writeln('Extracting and uploading translations to Crowdin...'.magenta);
var tasks = [
'exec:babel_extract',
'exec:crowdin_upload'
];
if (process.env.CROWDIN_API_KEY) {
grunt.task.run(tasks);
} else {
grunt.log.warn('Environment variable `CROWDIN_API_KEY` is not set, aborting task'.bold);
}
grunt.task.run(tasks);
});
grunt.registerTask('download_trans', 'Download translations', function() {
grunt.log.writeln('Downloading and compiling translations from Crowdin...'.magenta);
var tasks = [
'exec:crowdin_download',
'exec:babel_compile',
'po2json'
];
if (process.env.CROWDIN_API_KEY) {
tasks.splice(1, 0, 'exec:crowdin_upload', 'exec:crowdin_download'); // insert items at index 1
grunt.task.run(tasks);
} else {
tasks.splice(1, 0, 'exec:babel_update'); // insert item at index 1
grunt.log.warn('Environment variable `CROWDIN_API_KEY` is not set, not syncing with Crowdin.'.bold);
grunt.log.warn('Environment variable `CROWDIN_API_KEY` is not set, aborting task.'.bold);
}
});
grunt.task.run(tasks);
grunt.registerTask('sync_trans', 'Sync translations with Crowdin', function() {
grunt.log.writeln('Syncing translations with Crowdin...'.magenta);
var tasks = [
'upload_trans',
'download_trans'
];
if (process.env.CROWDIN_API_KEY) {
grunt.task.run(tasks);
} else {
grunt.log.warn('Environment variable `CROWDIN_API_KEY` is not set, aborting task.'.bold);
}
});
};
\ No newline at end of file
# Changelog
- * 9aa88b1 - 2017-10-15: Added Gettext translation features to core javascript code
- * 9df66c2 - 2017-10-16: Finish i18n feature code
- * 7866282 - 2017-10-15: Added Gettext translation features to core javascript code
- * 2a12ed2 - 2017-10-15: Added more i18n support for strings
- * c1ab882 - 2017-10-15: Fixed issues with setting minimum seeders and leechers
- * 7b9275f - 2017-10-15: Optimized placement of gettext installation code
......
......@@ -7,7 +7,7 @@
<%block name="tabs">
<li class="active"><a data-toggle="tab" href="#core-tab-pane1">${_('AnimeDB Settings')}</a></li>
<li><a data-toggle="tab" href="#core-tab-pane2">${_('Look and Feel')}</a></li>
<li><a data-toggle="tab" href="#core-tab-pane2">${_('User Interface')}</a></li>
</%block>
<%block name="pages">
......@@ -47,7 +47,7 @@
</div>
<input type="text" name="anidb_username" id="anidb_username"
value="${sickrage.srCore.srConfig.ANIDB_USERNAME}"
title="${_('AniDB username')}"
title="${_('AniDB Username')}"
class="form-control"
autocapitalize="off"/>
</div>
......@@ -64,7 +64,7 @@
</div>
<input type="password" name="anidb_password" id="anidb_password"
value="${sickrage.srCore.srConfig.ANIDB_PASSWORD}"
title="${_('AniDB password')}"
title="${_('AniDB Password')}"
class="form-control"
autocapitalize="off"/>
</div>
......@@ -95,7 +95,7 @@
<div id="core-tab-pane2" class="tab-pane fade">
<div class="row tab-pane">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12 tab-pane-desc">
<h3>${_('Look and Feel')}</h3>
<h3>${_('User Interface')}</h3>
</div>
<fieldset class="col-lg-9 col-md-8 col-sm-8 col-xs-12 tab-pane-list">
<div class="row field-pair">
......
......@@ -1537,8 +1537,9 @@ class Home(WebHandler):
if len(errors) > 0:
sickrage.srCore.srNotifications.error(
_('%d error%s while saving changes:') % (len(errors), "" if len(errors) == 1 else "s"),
'<ul>' + '\n'.join(['<li>%s</li>' % error for error in map(str, errors)]) + "</ul>")
_('{num_errors:d} error{plural} while saving changes:').format(num_errors=len(errors),
plural="" if len(errors) == 1 else "s"),
'<ul>' + '\n'.join(['<li>{0}</li>'.format(error) for error in errors]) + "</ul>")
return self.redirect("/home/displayShow?show=" + show)
......@@ -3349,7 +3350,8 @@ class Manage(Home, WebRoot):
if len(errors) > 0:
sickrage.srCore.srNotifications.error(
_('%d error%s while saving changes:') % (len(errors), "" if len(errors) == 1 else "s"),
_('{num_errors:d} error{plural} while saving changes:').format(num_errors=len(errors),
plural="" if len(errors) == 1 else "s"),
" ".join(errors))
return self.redirect("/manage/")
......@@ -4385,7 +4387,7 @@ class ConfigProviders(Config):
}
# update provider object
[setattr(providerObj, k, v) for k,v in providerSettings.items() if hasattr(providerObj, k)]
[setattr(providerObj, k, v) for k, v in providerSettings.items() if hasattr(providerObj, k)]
except Exception as e:
continue
......
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment