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

Commit deb6b06

Browse files
committed
Merge branch 'master' into t/ckeditor5-mention/74
2 parents 679059f + c2d0631 commit deb6b06

File tree

9 files changed

+105
-9
lines changed

9 files changed

+105
-9
lines changed

lang/contexts.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"Rich Text Editor, %0": "Title of the CKEditor5 editor.",
33
"Rich Text Editor": "Title of the CKEditor5 editor.",
4-
"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)"
4+
"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)",
5+
"Next": "Label for a button showing the next thing (tab, page, etc.).",
6+
"Previous": "Label for a button showing the previous thing (tab, page, etc.)."
57
}

lang/translations/en-au.po

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ msgstr "Rich Text Editor"
2626

2727
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)"
2828
msgid "Edit block"
29-
msgstr ""
29+
msgstr "Edit block"

lang/translations/fi.po

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ msgstr "Rikas tekstieditori"
2626

2727
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)"
2828
msgid "Edit block"
29-
msgstr ""
29+
msgstr "Muokkaa lohkoa"

lang/translations/lt.po

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
2+
#
3+
# !!! IMPORTANT !!!
4+
#
5+
# Before you edit this file, please keep in mind that contributing to the project
6+
# translations is possible ONLY via the Transifex online service.
7+
#
8+
# To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9+
#
10+
# To learn more, check out the official contributor's guide:
11+
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12+
#
13+
msgid ""
14+
msgstr ""
15+
"Language-Team: Lithuanian (https://www.transifex.com/ckeditor/teams/11143/lt/)\n"
16+
"Language: lt\n"
17+
"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"
18+
19+
msgctxt "Title of the CKEditor5 editor."
20+
msgid "Rich Text Editor, %0"
21+
msgstr "Raiškiojo teksto redaktorius, %0"
22+
23+
msgctxt "Title of the CKEditor5 editor."
24+
msgid "Rich Text Editor"
25+
msgstr "Raiškiojo teksto redaktorius"
26+
27+
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)"
28+
msgid "Edit block"
29+
msgstr "Redaguoti bloką"

lang/translations/ne.po

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ msgstr "धनी पाठ सम्पादक"
2626

2727
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)"
2828
msgid "Edit block"
29-
msgstr ""
29+
msgstr "ब्लक सम्पादन गर्न"

lang/translations/ru.po

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ msgstr "Редактор"
2626

2727
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)"
2828
msgid "Edit block"
29-
msgstr ""
29+
msgstr "Редактировать блок"

lang/translations/zh.po

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ msgstr "豐富文字編輯器"
2626

2727
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)"
2828
msgid "Edit block"
29-
msgstr ""
29+
msgstr "編輯區塊"

src/panel/balloon/contextualballoon.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ export default class ContextualBalloon extends Plugin {
407407

408408
const current = Array.from( this._idToStack.values() ).indexOf( this._visibleStack ) + 1;
409409

410-
return `${ current } ${ t( 'of' ) } ${ numberOfStacks }`;
410+
return t( '%0 of %1', [ current, numberOfStacks ] );
411411
} );
412412

413413
view.buttonNextView.on( 'execute', () => {
@@ -535,14 +535,14 @@ class RotatorView extends View {
535535
*
536536
* @type {module:ui/button/buttonview~ButtonView}
537537
*/
538-
this.buttonPrevView = this._createButtonView( t( 'Previous baloon' ), prevIcon );
538+
this.buttonPrevView = this._createButtonView( t( 'Previous' ), prevIcon );
539539

540540
/**
541541
* Navigation button for switching stack to the next one.
542542
*
543543
* @type {module:ui/button/buttonview~ButtonView}
544544
*/
545-
this.buttonNextView = this._createButtonView( t( 'Next balloon' ), nextIcon );
545+
this.buttonNextView = this._createButtonView( t( 'Next' ), nextIcon );
546546

547547
/**
548548
* Collection of the child views which creates rotator content.

tests/panel/balloon/contextualballoon.js

+65
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,34 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
1111
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
1212
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
1313
import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
14+
import { add as addTranslations, _clear as clearTranslations } from '@ckeditor/ckeditor5-utils/src/translation-service';
15+
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
1416

1517
/* global document, Event */
1618

1719
describe( 'ContextualBalloon', () => {
1820
let editor, editorElement, balloon, viewA, viewB, viewC, viewD;
1921

22+
testUtils.createSinonSandbox();
23+
24+
before( () => {
25+
addTranslations( 'en', {
26+
'Choose heading': '%0 of %1',
27+
'Previous': 'Previous',
28+
'Next': 'Next'
29+
} );
30+
31+
addTranslations( 'pl', {
32+
'%0 of %1': '%0 z %1',
33+
'Previous': 'Poprzedni',
34+
'Next': 'Następny'
35+
} );
36+
} );
37+
38+
after( () => {
39+
clearTranslations();
40+
} );
41+
2042
beforeEach( () => {
2143
editorElement = document.createElement( 'div' );
2244
document.body.appendChild( editorElement );
@@ -969,6 +991,49 @@ describe( 'ContextualBalloon', () => {
969991
expect( fakePanelsView.element.style.height ).to.equal( '40px' );
970992
} );
971993

994+
it( 'should translate the views', () => {
995+
// Cleanup the editor created by contextual balloon suite beforeEach.
996+
return editor.destroy()
997+
.then( () => {
998+
editorElement.remove();
999+
1000+
// Setup localized editor for language tests.
1001+
editorElement = document.createElement( 'div' );
1002+
document.body.appendChild( editorElement );
1003+
1004+
return ClassicTestEditor
1005+
.create( editorElement, {
1006+
plugins: [ Paragraph, ContextualBalloon ],
1007+
language: 'pl'
1008+
} );
1009+
} )
1010+
.then( newEditor => {
1011+
editor = newEditor;
1012+
1013+
balloon = editor.plugins.get( ContextualBalloon );
1014+
// We don't need to execute BalloonPanel pin and attachTo methods
1015+
// it's enough to check if was called with the proper data.
1016+
sinon.stub( balloon.view, 'attachTo' ).returns( {} );
1017+
sinon.stub( balloon.view, 'pin' ).returns( {} );
1018+
1019+
balloon.add( {
1020+
view: new View()
1021+
} );
1022+
1023+
balloon.add( {
1024+
view: new View(),
1025+
stackId: 'second'
1026+
} );
1027+
1028+
const rotatorView = balloon.view.content.get( 0 );
1029+
const counterElement = rotatorView.element.querySelector( '.ck-balloon-rotator__counter' );
1030+
1031+
expect( counterElement.textContent ).to.equal( '1 z 2' );
1032+
expect( rotatorView.buttonPrevView.labelView.element.textContent ).to.equal( 'Poprzedni' );
1033+
expect( rotatorView.buttonNextView.labelView.element.textContent ).to.equal( 'Następny' );
1034+
} );
1035+
} );
1036+
9721037
describe( 'singleViewMode', () => {
9731038
it( 'should not display navigation when there is more than one stack', () => {
9741039
const navigationElement = rotatorView.element.querySelector( '.ck-balloon-rotator__navigation' );

0 commit comments

Comments
 (0)