mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
f671f9d2c9
refs #5345, refs #3801 - Blog localisation - default is `en` (English) - you can change the language code in the admin panel, see https://github.com/TryGhost/Ghost-Admin/pull/703 - blog behaviour changes depending on the language e.g. date helper format - theme translation get's loaded if available depending on the language setting - falls back to english if not available - Theme translation - complete automatic translation of Ghost's frontend for site visitors (themes, etc.), to quickly deploy a site in a non-English language - added {{t}} and {{lang}} helper - no backend or admin panel translations (!) - easily readable translation keys - very simple translation - server restart required when adding new language files or changing existing files in the theme - no language code validation for now (will be added soon) - a full theme translation requires to translate Ghost core templates (e.g. subscriber form) - when activating a different theme, theme translations are auto re-loaded - when switching language of blog, theme translations are auto re-loaded - Bump gscan to version 1.3.0 to support more known helpers **Documentation can be found at https://themes.ghost.org/v1.20.0/docs/i18n.**
38 lines
1.6 KiB
JavaScript
38 lines
1.6 KiB
JavaScript
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
|
var should = require('should'), // jshint ignore:line
|
|
_ = require('lodash'),
|
|
hbs = require.main.require('core/server/services/themes/engine'),
|
|
|
|
// Stuff we are testing
|
|
helpers = require.main.require('core/server/helpers');
|
|
|
|
describe('Helpers', function () {
|
|
var hbsHelpers = ['each', 'if', 'unless', 'with', 'helperMissing', 'blockHelperMissing', 'log', 'lookup'],
|
|
ghostHelpers = [
|
|
'asset', 'author', 'body_class', 'content', 'date', 'encode', 'excerpt', 'facebook_url', 'foreach', 'get',
|
|
'ghost_foot', 'ghost_head', 'has', 'img_url', 'is', 'lang', 'meta_description', 'meta_title', 'navigation',
|
|
'next_post', 'page_url', 'pagination', 'plural', 'post_class', 'prev_post', 'reading_time', 't', 'tags', 'title', 'twitter_url',
|
|
'url'
|
|
],
|
|
expectedHelpers = _.concat(hbsHelpers, ghostHelpers);
|
|
|
|
describe('Load Core Helpers', function () {
|
|
before(function () {
|
|
helpers.loadCoreHelpers();
|
|
});
|
|
|
|
// This will work when we finish refactoring
|
|
it('should have exactly the right helpers', function () {
|
|
var foundHelpers, missingHelpers, unexpectedHelpers;
|
|
|
|
foundHelpers = _.keys(hbs.handlebars.helpers);
|
|
|
|
missingHelpers = _.difference(expectedHelpers, foundHelpers);
|
|
unexpectedHelpers = _.difference(foundHelpers, expectedHelpers);
|
|
|
|
missingHelpers.should.be.an.Array().with.lengthOf(0);
|
|
unexpectedHelpers.should.be.an.Array().with.lengthOf(0);
|
|
});
|
|
});
|
|
});
|