Skip to content

Commit

Permalink
add a test and example for i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
outsideris committed Jan 22, 2015
1 parent cffd836 commit cce259a
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<!--summernote-->
<link rel="stylesheet" href="components/summernote/dist/summernote.css" />
<script src="components/summernote/dist/summernote.js"></script>
<script src="components/summernote/lang/summernote-de-DE.js"></script>

<!--angular-summernote dependencies -->
<script src="components/angular/angular.min.js"></script>
Expand Down Expand Up @@ -43,6 +44,9 @@ <h4>height</h4>
<h4>focus</h4>
<summernote focus></summernote>

<h4>lang</h4>
<summernote lang="de-DE"></summernote>

<div ng-controller="AirmodeCtrl">
<h4>airmode</h4>
<summernote airMode ng-model="text">
Expand Down
9 changes: 9 additions & 0 deletions test/angular-summernote.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,21 @@ describe('Summernote directive', function() {

it('"lang" needs the lang file', function() {
var fn = $compile('<summernote lang="ko-KR"></summernote>');

try {
fn($rootScope);
} catch(e) {
expect(e.message).to.be.exist;
}
});

it.only('"lang" load the lang file correctly', function() {
var element = $compile('<summernote lang="de-DE"></summernote>')(scope);
$rootScope.$digest();

expect(element.next().find('.note-toolbar > .note-help .btn-default').attr('data-original-title'))
.to.be.equal('Hilfe');
});
});

describe('destroy', function() {
Expand Down
1 change: 1 addition & 0 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = function(config) {
'../examples/components/jquery/dist/jquery.js',
'../examples/components/bootstrap/dist/js/bootstrap.min.js',
'../examples/components/summernote/dist/summernote.js',
'lang/summernote-de-DE.js',
'../examples/components/angular/angular.min.js',

// application code
Expand Down
95 changes: 95 additions & 0 deletions test/lang/summernote-de-DE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
(function ($) {
$.extend($.summernote.lang, {
'de-DE': {
font: {
bold: 'Fett',
italic: 'Kursiv',
underline: 'Unterstreichen',
clear: 'Zurücksetzen',
height: 'Zeilenhöhe'
},
image: {
image: 'Grafik',
insert: 'Grafik einfügen',
resizeFull: 'Originalgröße',
resizeHalf: 'Größe 1/2',
resizeQuarter: 'Größe 1/4',
floatLeft: 'Linksbündig',
floatRight: 'Rechtsbündig',
floatNone: 'Kein Textfluss',
dragImageHere: 'Ziehen Sie ein Bild mit der Maus hierher',
selectFromFiles: 'Wählen Sie eine Datei aus',
url: 'Grafik URL',
remove: 'Grafik entfernen'
},
link: {
link: 'Link',
insert: 'Link einfügen',
unlink: 'Link entfernen',
edit: 'Editieren',
textToDisplay: 'Anzeigetext',
url: 'Ziel des Links?',
openInNewWindow: 'In einem neuen Fenster öffnen'
},
table: {
table: 'Tabelle'
},
hr: {
insert: 'Eine horizontale Linie einfügen'
},
style: {
style: 'Stil',
normal: 'Normal',
blockquote: 'Zitat',
pre: 'Quellcode',
h1: 'Überschrift 1',
h2: 'Überschrift 2',
h3: 'Überschrift 3',
h4: 'Überschrift 4',
h5: 'Überschrift 5',
h6: 'Überschrift 6'
},
lists: {
unordered: 'Aufzählung',
ordered: 'Nummerierung'
},
options: {
help: 'Hilfe',
fullscreen: 'Vollbild',
codeview: 'HTML-Code anzeigen'
},
paragraph: {
paragraph: 'Absatz',
outdent: 'Einzug vergrößern',
indent: 'Einzug verkleinern',
left: 'Links ausrichten',
center: 'Zentriert ausrichten',
right: 'Rechts ausrichten',
justify: 'Blocksatz'
},
color: {
recent: 'Letzte Farbe',
more: 'Mehr Farben',
background: 'Hintergrundfarbe',
foreground: 'Schriftfarbe',
transparent: 'Transparenz',
setTransparent: 'Transparenz setzen',
reset: 'Zurücksetzen',
resetToDefault: 'Auf Standard zurücksetzen'
},
shortcut: {
shortcuts: 'Tastenkürzel',
close: 'Schließen',
textFormatting: 'Textformatierung',
action: 'Aktion',
paragraphFormatting: 'Absatzformatierung',
documentStyle: 'Dokumentenstil'
},
history: {
undo: 'Rückgängig',
redo: 'Wiederholen'
}

}
});
})(jQuery);

0 comments on commit cce259a

Please sign in to comment.