mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +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
21 lines
530 B
JavaScript
21 lines
530 B
JavaScript
// # lang helper
|
|
// {{lang}} gives the current language tag
|
|
// Usage example: <html lang="{{lang}}">
|
|
//
|
|
// Examples of language tags from RFC 5646:
|
|
// de (German)
|
|
// fr (French)
|
|
// ja (Japanese)
|
|
// en-US (English as used in the United States)
|
|
//
|
|
// Standard:
|
|
// Language tags in HTML and XML
|
|
// https://www.w3.org/International/articles/language-tags/
|
|
|
|
const {SafeString} = require('../services/proxy');
|
|
|
|
module.exports = function lang(options) {
|
|
const locale = options.data.site.locale;
|
|
return new SafeString(locale);
|
|
};
|