mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
9ce407966f
- when activating a theme, we need to load the current locale - this request used to be buried deep in the themeI18n init call - now we surface it in the bridge and pass it down, which is closer to what we want to do with eventually initialising the frontend with everything it needs up front (or not initialising it, if it isn't needed) - in the related helpers we depend on the site.locale value instead of proxy -> themeI18n -> settingsCache drastically simplifying the code and removing deep requires - site.locale is updated via middleware and can be relied upon
29 lines
686 B
JavaScript
29 lines
686 B
JavaScript
const should = require('should');
|
|
const helpers = require('../../../core/frontend/helpers');
|
|
|
|
describe('{{lang}} helper', function () {
|
|
it('returns correct language tag', function () {
|
|
const locales = [
|
|
'en',
|
|
'en-gb',
|
|
'de'
|
|
];
|
|
|
|
locales.forEach((locale) => {
|
|
const context = {
|
|
hash: {},
|
|
data: {
|
|
site: {
|
|
locale
|
|
}
|
|
}
|
|
};
|
|
|
|
let rendered = helpers.lang.call({}, context);
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(locale);
|
|
});
|
|
});
|
|
});
|