|
167 | 167 | */ |
168 | 168 |
|
169 | 169 | /** |
170 | | - * The editor UI's language. |
| 170 | + * The language of the editor UI and its content. |
171 | 171 | * |
172 | | - * The language code is defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard. |
173 | | - * CKEditor 5 currently supports around 20 languages and the number is growing. |
| 172 | + * Note: You do not have to specify this option if your build is optimized for one UI language or if it is |
| 173 | + * the default language (English is the default language for CDN builds), unless you want to change |
| 174 | + * the language of your content. |
174 | 175 | * |
175 | | - * Note: You do not have to specify this option if your build is optimized for one language or if it is the default language |
176 | | - * (English is the default language for CDN builds). |
177 | | - * |
178 | | - * Simple usage: |
| 176 | + * Simple usage (change the language of the UI and the content): |
179 | 177 | * |
180 | 178 | * ClassicEditor |
181 | 179 | * .create( document.querySelector( '#editor' ), { |
| 180 | + * // The UI of the editor as well as its content will be in German. |
182 | 181 | * language: 'de' |
183 | 182 | * } ) |
184 | 183 | * .then( editor => { |
|
188 | 187 | * console.error( error ); |
189 | 188 | * } ); |
190 | 189 | * |
191 | | - * After this step you need to attach the corresponding translation file. Translation files are available on CDN for predefined builds: |
| 190 | + * Use different languages for the UI and the content using the object syntax: |
| 191 | + * |
| 192 | + * ClassicEditor |
| 193 | + * .create( document.querySelector( '#editor' ), { |
| 194 | + * language: { |
| 195 | + * // The UI will be in English. |
| 196 | + * ui: 'en', |
| 197 | + * |
| 198 | + * // But the content will be edited in Arabic. |
| 199 | + * content: 'ar' |
| 200 | + * } |
| 201 | + * } ) |
| 202 | + * .then( editor => { |
| 203 | + * console.log( editor ); |
| 204 | + * } ) |
| 205 | + * .catch( error => { |
| 206 | + * console.error( error ); |
| 207 | + * } ); |
| 208 | + * |
| 209 | + * The language of the content has an impact on the editing experience, for instance it affects screen readers |
| 210 | + * and spell checkers. It is also particularly useful for typing in certain languages (e.g. right–to–left ones) |
| 211 | + * because it changes the default alignment of the text. |
| 212 | + * |
| 213 | + * The language codes are defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard. |
| 214 | + * |
| 215 | + * You need to add the corresponding translation file for the new UI language to work. |
| 216 | + * Translation files are available on CDN for predefined builds: |
| 217 | + * |
192 | 218 | * `<script src="https://cdn.ckeditor.com/ckeditor5/[version.number]/[distribution]/lang/[lang].js"></script>` |
193 | 219 | * |
194 | 220 | * But you can add them manually by coping from the `node_modules/@ckeditor/ckeditor5-build-[name]/build/lang/[lang].js'`. |
195 | 221 | * |
196 | 222 | * Check the {@glink features/ui-language UI language guide} for more information about the localization options and translation process. |
197 | 223 | * |
198 | | - * @member {String} module:core/editor/editorconfig~EditorConfig#language |
| 224 | + * @member {String|Object} module:core/editor/editorconfig~EditorConfig#language |
199 | 225 | */ |
200 | 226 |
|
201 | 227 | /** |
|
0 commit comments