Explorar el Código

Aligned the code to the latest Locale class API.

Aleksander Nowodzinski hace 6 años
padre
commit
553bfae8c5

+ 1 - 1
packages/ckeditor5-ui/src/dropdown/dropdownview.js

@@ -317,7 +317,7 @@ export default class DropdownView extends View {
 	get _panelPositions() {
 		const { southEast, southWest, northEast, northWest } = DropdownView.defaultPanelPositions;
 
-		if ( this.locale.languageDirection === 'ltr' ) {
+		if ( this.locale.uiLanguageDirection === 'ltr' ) {
 			return [ southEast, southWest, northEast, northWest ];
 		} else {
 			return [ southWest, southEast, northWest, northEast ];

+ 2 - 2
packages/ckeditor5-ui/src/editorui/boxed/boxededitoruiview.js

@@ -66,8 +66,8 @@ export default class BoxedEditorUIView extends EditorUIView {
 					'ck-rounded-corners'
 				],
 				role: 'application',
-				dir: locale.languageDirection,
-				lang: locale.language,
+				dir: locale.uiLanguageDirection,
+				lang: locale.uiLanguage,
 				'aria-labelledby': `ck-editor__aria-label_${ ariaLabelUid }`
 			},
 

+ 1 - 1
packages/ckeditor5-ui/src/editorui/editoruiview.js

@@ -79,7 +79,7 @@ export default class EditorUIView extends View {
 					'ck-body',
 					'ck-rounded-corners'
 				],
-				dir: locale.languageDirection,
+				dir: locale.uiLanguageDirection,
 			},
 			children: this.body
 		} ).render();

+ 1 - 1
packages/ckeditor5-ui/src/toolbar/block/blocktoolbar.js

@@ -371,7 +371,7 @@ export default class BlockToolbar extends Plugin {
 				( contentRect, buttonRect ) => {
 					let left;
 
-					if ( this.editor.locale.languageDirection === 'ltr' ) {
+					if ( this.editor.locale.uiLanguageDirection === 'ltr' ) {
 						left = editableRect.left - buttonRect.width;
 					} else {
 						left = editableRect.right;

+ 2 - 2
packages/ckeditor5-ui/tests/dropdown/dropdownview.js

@@ -19,7 +19,7 @@ describe( 'DropdownView', () => {
 
 	beforeEach( () => {
 		locale = {
-			languageDirection: 'ltr',
+			uiLanguageDirection: 'ltr',
 			t() {}
 		};
 
@@ -150,7 +150,7 @@ describe( 'DropdownView', () => {
 						const spy = testUtils.sinon.spy( DropdownView, '_getOptimalPosition' );
 						const { southEast, southWest, northEast, northWest } = DropdownView.defaultPanelPositions;
 
-						view.locale.languageDirection = 'rtl';
+						view.locale.uiLanguageDirection = 'rtl';
 						view.isOpen = true;
 
 						sinon.assert.calledWithExactly( spy, sinon.match( {

+ 6 - 3
packages/ckeditor5-ui/tests/editableui/editableuiview.js

@@ -18,7 +18,7 @@ describe( 'EditableUIView', () => {
 	testUtils.createSinonSandbox();
 
 	beforeEach( () => {
-		locale = new Locale( 'en' );
+		locale = new Locale();
 		editableElement = document.createElement( 'div' );
 
 		editingView = new EditingView();
@@ -80,7 +80,7 @@ describe( 'EditableUIView', () => {
 		} );
 
 		it( 'sets proper lang and dir attributes (implicit content language)', () => {
-			const locale = new Locale( 'ar' );
+			const locale = new Locale( { uiLanguage: 'ar' } );
 			const view = new EditableUIView( locale, editingView );
 			view.name = editingViewRoot.rootName;
 
@@ -93,7 +93,10 @@ describe( 'EditableUIView', () => {
 		} );
 
 		it( 'sets proper lang and dir attributes (explicit content language)', () => {
-			const locale = new Locale( 'pl', 'ar' );
+			const locale = new Locale( {
+				uiLanguage: 'pl',
+				contentLanguage: 'ar'
+			} );
 			const view = new EditableUIView( locale, editingView );
 			view.name = editingViewRoot.rootName;
 

+ 2 - 2
packages/ckeditor5-ui/tests/editorui/boxed/boxededitoruiview.js

@@ -11,7 +11,7 @@ describe( 'BoxedEditorUIView', () => {
 	let view, element;
 
 	beforeEach( () => {
-		view = new BoxedEditorUIView( new Locale( 'en' ) );
+		view = new BoxedEditorUIView( new Locale() );
 		view.render();
 		element = view.element;
 	} );
@@ -62,7 +62,7 @@ describe( 'BoxedEditorUIView', () => {
 		} );
 
 		it( 'sets the proper "dir" attribute value when using RTL language', () => {
-			const view = new BoxedEditorUIView( new Locale( 'ar' ) );
+			const view = new BoxedEditorUIView( new Locale( { uiLanguage: 'ar' } ) );
 
 			view.render();
 

+ 2 - 2
packages/ckeditor5-ui/tests/editorui/editoruiview.js

@@ -16,7 +16,7 @@ describe( 'EditorUIView', () => {
 	testUtils.createSinonSandbox();
 
 	beforeEach( () => {
-		locale = new Locale( 'en' );
+		locale = new Locale();
 		view = new EditorUIView( locale );
 
 		view.render();
@@ -54,7 +54,7 @@ describe( 'EditorUIView', () => {
 		} );
 
 		it( 'sets the right dir attribute to the body region (RTL)', () => {
-			const locale = new Locale( 'ar' );
+			const locale = new Locale( { uiLanguage: 'ar' } );
 			const view = new EditorUIView( locale );
 
 			view.render();

+ 1 - 1
packages/ckeditor5-ui/tests/toolbar/block/blocktoolbar.js

@@ -346,7 +346,7 @@ describe( 'BlockToolbar', () => {
 		} );
 
 		it( 'should attach the left side of the button to the right side of the editable when language direction is RTL', () => {
-			editor.locale.languageDirection = 'rtl';
+			editor.locale.uiLanguageDirection = 'rtl';
 
 			setData( editor.model, '<paragraph>foo[]bar</paragraph>' );