From 41c93f982ddbd2b7fe89c39aff12935ca31b5ac3 Mon Sep 17 00:00:00 2001 From: Naz Date: Thu, 4 Mar 2021 16:00:02 +1300 Subject: [PATCH] Added 'locale' property to public settings refs https://github.com/TryGhost/Team/issues/509 - During 3.x we standardised on "lang" instead of "default_locale" for the site setting, which was an assumption based on an earlier change to @site.lang to make read nicer. This was a mistake as the field represents more than "lang" its a "locale". With this changeset we introduce a transition to use "locale" name for the value instead of "lang" - Adds `@site.locale" value in as well as new 'locale' property in Content API's response - "lang" will be considered as deprecated starting with API v4 and will be dropped completely with API v5 --- core/server/services/settings/public.js | 1 + test/api-acceptance/content/settings_spec.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/server/services/settings/public.js b/core/server/services/settings/public.js index bae3b37795..8d4e8497ea 100644 --- a/core/server/services/settings/public.js +++ b/core/server/services/settings/public.js @@ -16,6 +16,7 @@ module.exports = { facebook: 'facebook', twitter: 'twitter', lang: 'lang', + locale: 'lang', timezone: 'timezone', codeinjection_head: 'codeinjection_head', codeinjection_foot: 'codeinjection_foot', diff --git a/test/api-acceptance/content/settings_spec.js b/test/api-acceptance/content/settings_spec.js index 789863d840..4afe255197 100644 --- a/test/api-acceptance/content/settings_spec.js +++ b/test/api-acceptance/content/settings_spec.js @@ -19,6 +19,7 @@ const defaultSettingsKeys = [ 'facebook', 'twitter', 'lang', + 'locale', 'timezone', 'codeinjection_head', 'codeinjection_foot', @@ -82,7 +83,7 @@ describe('Settings Content API', function () { settings.should.have.properties(publicProperties); // The length below should only change when public settings have been removed or added - Object.keys(settings).length.should.equal(24); + Object.keys(settings).length.should.equal(25); Object.keys(settings).should.deepEqual(defaultSettingsKeys); // Verify that we are returning the defaults for each value