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

Commit 8720973

Browse files
authored
Merge pull request #109 from ckeditor/t/ckeditor5/624
Other: Changed `config.lang` to `config.languages` to align naming convention. Part of the Translation Service v2.
2 parents 4d856f7 + 77c8c11 commit 8720973

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

src/editor/editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default class Editor {
6363
* @readonly
6464
* @member {module:utils/locale~Locale}
6565
*/
66-
this.locale = new Locale( this.config.get( 'lang' ) );
66+
this.locale = new Locale( this.config.get( 'language' ) );
6767

6868
/**
6969
* Shorthand for {@link module:utils/locale~Locale#t}.

src/editor/editorconfig.jsdoc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,35 @@
106106
*
107107
* @member {Array.<String>|Object} module:core/editor/editorconfig~EditorConfig#toolbar
108108
*/
109+
110+
/**
111+
* Editor UI's language.
112+
*
113+
* The language code is defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
114+
* CKEditor 5 currently supports around 20 languages and the number is growing.
115+
*
116+
* Note: You don't have to specify this option if your build is optimized for one language or if it's the default language
117+
* (English is the default language for CDN builds).
118+
*
119+
* Simple usage:
120+
*
121+
* ClassicEditor
122+
* .create( document.querySelector( '#editor' ), {
123+
* language: 'de'
124+
* } )
125+
* .then( editor => {
126+
* console.log( editor );
127+
* } )
128+
* .catch( error => {
129+
* console.error( error );
130+
* } );
131+
*
132+
* After this step you need to attach the corresponding translation file. Translation files are available at CDN for predefined builds:
133+
* `<script src="https://cdn.ckeditor.com/ckeditor5/[version.number]/[distribution]/lang/[lang].js"></script>`
134+
*
135+
* But you can add them manually by coping from the `node_modules/@ckeditor/ckeditor5-build-[name]/build/lang/[lang].js'`.
136+
*
137+
* Check the {@glink features/ui-language UI language guide} for more information about the localization options and translation process.
138+
*
139+
* @member {String} module:core/editor/editorconfig~EditorConfig#language
140+
*/

tests/editor/editor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ describe( 'Editor', () => {
151151
expect( editor.t ).to.equal( editor.locale.t );
152152
} );
153153

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

157-
expect( editor.locale.lang ).to.equal( 'pl' );
157+
expect( editor.locale.language ).to.equal( 'pl' );
158158
} );
159159
} );
160160

0 commit comments

Comments
 (0)