blob: 816915b1c9b73ddea6c8685cd399fc60421d0699 [file] [log] [blame]
talig8e9c0652017-12-20 14:30:43 +02001import React from 'react';
2import {storiesOf, action} from '@kadira/storybook';
3import {text, number} from '@kadira/storybook-addon-knobs';
4import {withKnobs} from '@kadira/storybook-addon-knobs';
5import i18n from 'nfvo-utils/i18n/i18n.js';
6import i18nJson from 'nfvo-utils/i18n/en.json';
7
8const stories = storiesOf('i18n', module);
9stories.addDecorator(withKnobs);
10
11
12i18nJson['added'] = 'this is my test';
13i18nJson['added with {param}'] = 'this is my test with {param}';
14
15stories
16 .add('i18n tests', () => {
17 let keys = [
18 'I do not exist',
19 'Delete',
20 'OrchestrationTemplateCandidate/File Structure'
21 ];
22 let translations = [];
23 let i=0;
24 translations.push(<div id={i++}>KEY: VALUE</div>)
25 keys.forEach((key) => {
26 translations.push((<div id={i++}>{key} : {i18n(key)} </div>));
27 });
28 var param = 'param';
29 translations.push((<div id={i++}>added : {i18n('added')} </div>));
30 translations.push((<div id={i++}><font color="red"><b>WRONG</b></font> - added with ${param} in translation : {i18n(`added with ${param}`)} </div>));
31 translations.push((<div id={i++}><font color="green"><b>RIGHT</b></font> - added with ${param} and options object {JSON.stringify({param:param})}: {i18n('added with {param}', {param: param})} </div>));
32
33 return (<div>{translations}</div>);
34 })
35;