bem/webpack-bem-loader

BEM.i18n callback for wrapping Components

Yeti-or opened this issue · 0 comments

Right now we have <i18n:param> for better localization.

and we use it like this:

{
 "myKey": "Some text <i18n:param>someParam</i18n:param>"
}

an in code:

import i18n from 'b:awesomeB t:i18n';

<input value={ i18n('mykey',  { someParam: 'wow' }) } >;

And it's cool
but what to do if we want to localize string with Component inside, or .

like:

import i18n from 'b:awesomeB t:i18n';

const button = (text) => (<button>{ text }</button>);

<span>{ i18n('myKeyInsideButton', { someParam: button }) }</span>

What syntax in keysets should we use?

my proposal:

{
"myKey": "... and then button: <i18n:wrap name='someParam'>Localized Btn-text</i18n:wrap>"
}

@veged any suggestions?