2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

🎨 rename language to locale and use en as default locale (#8490)

no issue
- this PR references indirecty to https://github.com/TryGhost/Ghost/pull/8437
- i would like to have the settings change already in place before we release the beta
- the i18n feature is able to change the locale of Ghost
- most i18n libraries use locale
- adding/changing settings doesn't require a migration file, but it can make the database a bit messy (because you can end up with default_locale and lang)
- furthermore we agreed that the default locale for Ghost should be simply `en`, not `en_US` or `en_GB`
This commit is contained in:
Katharina Irrgang 2017-05-31 17:05:49 +02:00 committed by Kevin Ansfield
parent 85496f409a
commit 18b71f32b1
8 changed files with 14 additions and 16 deletions

View file

@ -29,8 +29,8 @@
"icon": {
"defaultValue": ""
},
"default_lang": {
"defaultValue": "en_US",
"default_locale": {
"defaultValue": "en",
"validations": {
"isEmpty": false
}

View file

@ -11,7 +11,6 @@
"featured": false,
"page": false,
"status": "published",
"language": "en_US",
"meta_title": null,
"meta_description": null
}

View file

@ -12,7 +12,7 @@ module.exports = {
featured: {type: 'bool', nullable: false, defaultTo: false},
page: {type: 'bool', nullable: false, defaultTo: false},
status: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'draft'},
language: {type: 'string', maxlength: 6, nullable: false, defaultTo: 'en_US'},
locale: {type: 'string', maxlength: 6, nullable: true},
visibility: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'public', validations: {isIn: [['public']]}},
meta_title: {type: 'string', maxlength: 2000, nullable: true},
meta_description: {type: 'string', maxlength: 2000, nullable: true},
@ -41,7 +41,7 @@ module.exports = {
twitter: {type: 'string', maxlength: 2000, nullable: true},
accessibility: {type: 'text', maxlength: 65535, nullable: true},
status: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'active'},
language: {type: 'string', maxlength: 6, nullable: false, defaultTo: 'en_US'},
locale: {type: 'string', maxlength: 6, nullable: true},
visibility: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'public', validations: {isIn: [['public']]}},
meta_title: {type: 'string', maxlength: 2000, nullable: true},
meta_description: {type: 'string', maxlength: 2000, nullable: true},

View file

@ -6,7 +6,7 @@ var supportedLocales = ['en'],
chalk = require('chalk'),
MessageFormat = require('intl-messageformat'),
// TODO: fetch this dynamically based on overall blog settings (`key = "default_lang"`) in the `settings` table
// TODO: fetch this dynamically based on overall blog settings (`key = "default_locale"`) in the `settings` table
currentLocale = 'en',
blos,
I18n;

View file

@ -460,7 +460,7 @@ describe('Import', function () {
}).then(function () {
done(new Error('Allowed import of invalid post data'));
}).catch(function (response) {
response.length.should.equal(3, response);
response.length.should.equal(2, response);
response[0].errorType.should.equal('ValidationError');
response[0].message.should.eql('Value in [posts.title] cannot be blank.');
@ -468,8 +468,6 @@ describe('Import', function () {
response[1].errorType.should.equal('ValidationError');
response[1].message.should.eql('Value in [posts.status] cannot be blank.');
response[2].errorType.should.equal('ValidationError');
response[2].message.should.eql('Value in [posts.language] cannot be blank.');
done();
}).catch(done);
});

View file

@ -959,7 +959,9 @@ describe('Post Model', function () {
createdPost.get('slug').should.equal(newPostDB.slug + '-2');
(!!createdPost.get('featured')).should.equal(false);
(!!createdPost.get('page')).should.equal(false);
createdPost.get('language').should.equal('en_US');
should.equal(createdPost.get('locale'), null);
// testing for nulls
(createdPost.get('feature_image') === null).should.equal(true);
(createdPost.get('meta_title') === null).should.equal(true);

View file

@ -19,8 +19,8 @@ var should = require('should'), // jshint ignore:line
// both of which are required for migrations to work properly.
describe('DB version integrity', function () {
// Only these variables should need updating
var currentSchemaHash = 'd10bff0a4dbccbd5e5d66c9ed596301b',
currentFixturesHash = 'ec48af84f206fa377214ed4311ba6dfd';
var currentSchemaHash = 'b613bca0f20e02360487a3c17a9ffcc1',
currentFixturesHash = 'd9a19655448a168246a4849dc4591ba9';
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
// and the values above will need updating as confirmation

File diff suppressed because one or more lines are too long