Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #109 from ckeditor/t/ckeditor5/624
Browse files Browse the repository at this point in the history
Other: Changed `config.lang` to `config.languages` to align naming convention. Part of the Translation Service v2.
  • Loading branch information
szymonkups authored Nov 30, 2017
2 parents 4d856f7 + 77c8c11 commit 8720973
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class Editor {
* @readonly
* @member {module:utils/locale~Locale}
*/
this.locale = new Locale( this.config.get( 'lang' ) );
this.locale = new Locale( this.config.get( 'language' ) );

/**
* Shorthand for {@link module:utils/locale~Locale#t}.
Expand Down
32 changes: 32 additions & 0 deletions src/editor/editorconfig.jsdoc
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,35 @@
*
* @member {Array.<String>|Object} module:core/editor/editorconfig~EditorConfig#toolbar
*/

/**
* Editor UI's language.
*
* The language code is defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
* CKEditor 5 currently supports around 20 languages and the number is growing.
*
* Note: You don't have to specify this option if your build is optimized for one language or if it's the default language
* (English is the default language for CDN builds).
*
* Simple usage:
*
* ClassicEditor
* .create( document.querySelector( '#editor' ), {
* language: 'de'
* } )
* .then( editor => {
* console.log( editor );
* } )
* .catch( error => {
* console.error( error );
* } );
*
* After this step you need to attach the corresponding translation file. Translation files are available at CDN for predefined builds:
* `<script src="https://cdn.ckeditor.com/ckeditor5/[version.number]/[distribution]/lang/[lang].js"></script>`
*
* But you can add them manually by coping from the `node_modules/@ckeditor/ckeditor5-build-[name]/build/lang/[lang].js'`.
*
* Check the {@glink features/ui-language UI language guide} for more information about the localization options and translation process.
*
* @member {String} module:core/editor/editorconfig~EditorConfig#language
*/
6 changes: 3 additions & 3 deletions tests/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ describe( 'Editor', () => {
expect( editor.t ).to.equal( editor.locale.t );
} );

it( 'is configured with the config.lang', () => {
const editor = new Editor( { lang: 'pl' } );
it( 'is configured with the config.language', () => {
const editor = new Editor( { language: 'pl' } );

expect( editor.locale.lang ).to.equal( 'pl' );
expect( editor.locale.language ).to.equal( 'pl' );
} );
} );

Expand Down

0 comments on commit 8720973

Please sign in to comment.