Skip to content

Commit

Permalink
Merge bf04d83 into c3f7633
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Sep 26, 2018
2 parents c3f7633 + bf04d83 commit 1099278
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dadi/lib/controller/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ Languages.prototype.get = function (req, res, next) {
}

let languages = supportedLanguages.map(this._getLanguageDetails)

let metadata = {
defaultLanguage: this._getLanguageDetails(defaultLanguage),
fieldCharacter: config.get('i18n.fieldCharacter'),
totalCount: supportedLanguages.length
}

Expand Down
3 changes: 2 additions & 1 deletion features.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"aclv1",
"i18nv1"
"i18nv1",
"i18nv2"
]
21 changes: 21 additions & 0 deletions test/acceptance/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,27 @@ describe('Multi-language', function () {
done()
})
})

it('should include a `fieldCharacter` property in the metadata block', done => {
config.set('i18n.fieldCharacter', '@')

client
.get('/api/languages')
.set('Authorization', `Bearer ${bearerToken}`)
.expect(200)
.end((err, res) => {
if (err) return done(err)

let defaultLanguage = config.get('i18n.defaultLanguage')
let supportedLanguages = config.get('i18n.languages')

res.body.metadata.fieldCharacter.should.eql('@')

config.set('i18n.fieldCharacter', configBackup.i18n.fieldCharacter)

done()
})
})
})

it('should accept a language variation of a field, separated by the character configured in `i18n.fieldCharacter` (using default)', done => {
Expand Down

0 comments on commit 1099278

Please sign in to comment.