浏览代码

Merge branch 'master' into t/ckeditor5-mention/74

Piotrek Koszuliński 6 年之前
父节点
当前提交
a3c325f8ef

+ 3 - 1
packages/ckeditor5-ui/lang/contexts.json

@@ -1,5 +1,7 @@
 {
 	"Rich Text Editor, %0": "Title of the CKEditor5 editor.",
 	"Rich Text Editor": "Title of the CKEditor5 editor.",
-	"Edit block": "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
+	"Edit block": "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)",
+	"Next": "Label for a button showing the next thing (tab, page, etc.).",
+	"Previous": "Label for a button showing the previous thing (tab, page, etc.)."
 }

+ 1 - 1
packages/ckeditor5-ui/lang/translations/en-au.po

@@ -26,4 +26,4 @@ msgstr "Rich Text Editor"
 
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgid "Edit block"
-msgstr ""
+msgstr "Edit block"

+ 1 - 1
packages/ckeditor5-ui/lang/translations/fi.po

@@ -26,4 +26,4 @@ msgstr "Rikas tekstieditori"
 
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgid "Edit block"
-msgstr ""
+msgstr "Muokkaa lohkoa"

+ 29 - 0
packages/ckeditor5-ui/lang/translations/lt.po

@@ -0,0 +1,29 @@
+# Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+#
+#                                     !!! IMPORTANT !!!
+#
+#         Before you edit this file, please keep in mind that contributing to the project
+#                translations is possible ONLY via the Transifex online service.
+#
+#         To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
+#
+#                   To learn more, check out the official contributor's guide:
+#     https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
+#
+msgid ""
+msgstr ""
+"Language-Team: Lithuanian (https://www.transifex.com/ckeditor/teams/11143/lt/)\n"
+"Language: lt\n"
+"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);\n"
+
+msgctxt "Title of the CKEditor5 editor."
+msgid "Rich Text Editor, %0"
+msgstr "Raiškiojo teksto redaktorius, %0"
+
+msgctxt "Title of the CKEditor5 editor."
+msgid "Rich Text Editor"
+msgstr "Raiškiojo teksto redaktorius"
+
+msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
+msgid "Edit block"
+msgstr "Redaguoti bloką"

+ 1 - 1
packages/ckeditor5-ui/lang/translations/ne.po

@@ -26,4 +26,4 @@ msgstr "धनी पाठ सम्पादक"
 
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgid "Edit block"
-msgstr ""
+msgstr "ब्लक सम्पादन गर्न"

+ 1 - 1
packages/ckeditor5-ui/lang/translations/ru.po

@@ -26,4 +26,4 @@ msgstr "Редактор"
 
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgid "Edit block"
-msgstr ""
+msgstr "Редактировать блок"

+ 1 - 1
packages/ckeditor5-ui/lang/translations/zh.po

@@ -26,4 +26,4 @@ msgstr "豐富文字編輯器"
 
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgid "Edit block"
-msgstr ""
+msgstr "編輯區塊"

+ 3 - 3
packages/ckeditor5-ui/src/panel/balloon/contextualballoon.js

@@ -407,7 +407,7 @@ export default class ContextualBalloon extends Plugin {
 
 			const current = Array.from( this._idToStack.values() ).indexOf( this._visibleStack ) + 1;
 
-			return `${ current } ${ t( 'of' ) } ${ numberOfStacks }`;
+			return t( '%0 of %1', [ current, numberOfStacks ] );
 		} );
 
 		view.buttonNextView.on( 'execute', () => {
@@ -535,14 +535,14 @@ class RotatorView extends View {
 		 *
 		 * @type {module:ui/button/buttonview~ButtonView}
 		 */
-		this.buttonPrevView = this._createButtonView( t( 'Previous baloon' ), prevIcon );
+		this.buttonPrevView = this._createButtonView( t( 'Previous' ), prevIcon );
 
 		/**
 		 * Navigation button for switching stack to the next one.
 		 *
 		 * @type {module:ui/button/buttonview~ButtonView}
 		 */
-		this.buttonNextView = this._createButtonView( t( 'Next balloon' ), nextIcon );
+		this.buttonNextView = this._createButtonView( t( 'Next' ), nextIcon );
 
 		/**
 		 * Collection of the child views which creates rotator content.

+ 65 - 0
packages/ckeditor5-ui/tests/panel/balloon/contextualballoon.js

@@ -11,12 +11,34 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
+import { add as addTranslations, _clear as clearTranslations } from '@ckeditor/ckeditor5-utils/src/translation-service';
+import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
 /* global document, Event */
 
 describe( 'ContextualBalloon', () => {
 	let editor, editorElement, balloon, viewA, viewB, viewC, viewD;
 
+	testUtils.createSinonSandbox();
+
+	before( () => {
+		addTranslations( 'en', {
+			'Choose heading': '%0 of %1',
+			'Previous': 'Previous',
+			'Next': 'Next'
+		} );
+
+		addTranslations( 'pl', {
+			'%0 of %1': '%0 z %1',
+			'Previous': 'Poprzedni',
+			'Next': 'Następny'
+		} );
+	} );
+
+	after( () => {
+		clearTranslations();
+	} );
+
 	beforeEach( () => {
 		editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
@@ -969,6 +991,49 @@ describe( 'ContextualBalloon', () => {
 			expect( fakePanelsView.element.style.height ).to.equal( '40px' );
 		} );
 
+		it( 'should translate the views', () => {
+			// Cleanup the editor created by contextual balloon suite beforeEach.
+			return editor.destroy()
+				.then( () => {
+					editorElement.remove();
+
+					// Setup localized editor for language tests.
+					editorElement = document.createElement( 'div' );
+					document.body.appendChild( editorElement );
+
+					return ClassicTestEditor
+						.create( editorElement, {
+							plugins: [ Paragraph, ContextualBalloon ],
+							language: 'pl'
+						} );
+				} )
+				.then( newEditor => {
+					editor = newEditor;
+
+					balloon = editor.plugins.get( ContextualBalloon );
+					// We don't need to execute BalloonPanel pin and attachTo methods
+					// it's enough to check if was called with the proper data.
+					sinon.stub( balloon.view, 'attachTo' ).returns( {} );
+					sinon.stub( balloon.view, 'pin' ).returns( {} );
+
+					balloon.add( {
+						view: new View()
+					} );
+
+					balloon.add( {
+						view: new View(),
+						stackId: 'second'
+					} );
+
+					const rotatorView = balloon.view.content.get( 0 );
+					const counterElement = rotatorView.element.querySelector( '.ck-balloon-rotator__counter' );
+
+					expect( counterElement.textContent ).to.equal( '1 z 2' );
+					expect( rotatorView.buttonPrevView.labelView.element.textContent ).to.equal( 'Poprzedni' );
+					expect( rotatorView.buttonNextView.labelView.element.textContent ).to.equal( 'Następny' );
+				} );
+		} );
+
 		describe( 'singleViewMode', () => {
 			it( 'should not display navigation when there is more than one stack', () => {
 				const navigationElement = rotatorView.element.querySelector( '.ck-balloon-rotator__navigation' );