Renamed `defaultLocale` setting to `lang`

refs https://github.com/TryGhost/Ghost/issues/10318

- API has been updated to still work with `default_locale` for backwards compatibility but it makes sense for the client to match the underlying settings keys
This commit is contained in:
Kevin Ansfield 2020-06-24 15:27:17 +01:00
parent c8a93925a3
commit 9f9273fafc
4 changed files with 11 additions and 11 deletions

View File

@ -11,7 +11,7 @@ export default Model.extend(ValidationEngine, {
coverImage: attr('string'), coverImage: attr('string'),
icon: attr('string'), icon: attr('string'),
accentColor: attr('string'), accentColor: attr('string'),
defaultLocale: attr('string'), lang: attr('string'),
activeTimezone: attr('string', {defaultValue: 'Etc/UTC'}), activeTimezone: attr('string', {defaultValue: 'Etc/UTC'}),
codeinjectionHead: attr('string'), codeinjectionHead: attr('string'),
codeinjectionFoot: attr('string'), codeinjectionFoot: attr('string'),

View File

@ -126,7 +126,7 @@ export default class CustomViewsService extends Service {
return; return;
} }
let views = JSON.parse(settings.get('sharedViews') || '{}'); let views = JSON.parse(settings.get('sharedViews') || '[]');
views = isArray(views) ? views : []; views = isArray(views) ? views : [];
let viewList = []; let viewList = [];

View File

@ -76,23 +76,23 @@
<div class="gh-setting-content"> <div class="gh-setting-content">
<div class="gh-setting-title">Publication Language</div> <div class="gh-setting-title">Publication Language</div>
<div class="gh-setting-desc">Set the language/locale which is used on your site</div> <div class="gh-setting-desc">Set the language/locale which is used on your site</div>
{{#liquid-if this.defaultLocaleOpen}} {{#liquid-if this.langOpen}}
<div class="gh-setting-content-extended"> <div class="gh-setting-content-extended">
<GhFormGroup @errors={{this.settings.errors}} @hasValidated={{this.settings.hasValidated}} @property="defaultLocale"> <GhFormGroup @errors={{this.settings.errors}} @hasValidated={{this.settings.hasValidated}} @property="lang">
<GhTextInput <GhTextInput
@value={{readonly this.settings.defaultLocale}} @value={{readonly this.settings.lang}}
@input={{action (mut this.settings.defaultLocale) value="target.value"}} @input={{action (mut this.settings.lang) value="target.value"}}
@focus-out={{action "validate" "defaultLocale" target=this.settings}} @focus-out={{action "validate" "lang" target=this.settings}}
data-test-default-locale-input={{true}} data-test-input="lang"
/> />
<GhErrorMessage @errors={{this.settings.errors}} @property="defaultLocale" /> <GhErrorMessage @errors={{this.settings.errors}} @property="lang" />
<p>Default: English (<strong>en</strong>); you can add translation files to your theme for <a href="https://ghost.org/docs/api/handlebars-themes/helpers/translate/" target="_blank" rel="noopener">any language</a></p> <p>Default: English (<strong>en</strong>); you can add translation files to your theme for <a href="https://ghost.org/docs/api/handlebars-themes/helpers/translate/" target="_blank" rel="noopener">any language</a></p>
</GhFormGroup> </GhFormGroup>
</div> </div>
{{/liquid-if}} {{/liquid-if}}
</div> </div>
<div class="gh-setting-action"> <div class="gh-setting-action">
<button type="button" class="gh-btn" {{action (toggle "defaultLocaleOpen" this)}} data-test-toggle-default-locale><span>{{if this.defaultLocaleOpen "Close" "Expand"}}</span></button> <button type="button" class="gh-btn" {{action (toggle "langOpen" this)}} data-test-toggle-lang><span>{{if this.langOpen "Close" "Expand"}}</span></button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -42,7 +42,7 @@ export default [
}, },
{ {
id: 5, id: 5,
key: 'default_locale', key: 'lang',
value: 'en', value: 'en',
group: 'site', group: 'site',
created_at: '2013-11-25T14:48:11.000Z', created_at: '2013-11-25T14:48:11.000Z',