bem / bem-components

Set of components for sites development
https://bem.info/libraries/classic/bem-components/6.0.0/
Other
332 stars 86 forks source link

Using blocks in BEMJSON which provide strings #448

Closed tadatuta closed 8 years ago

tadatuta commented 10 years ago

For example

In attach.bemhtml there is

this.isSimple(button) && (button = {
                block : 'button',
                tag : 'span',
                text : button
            });

which won't work when i18n is used in bemjson:

{
            block : 'attach',
            mods : { theme : 'simple' },
            button : {
                block: 'i-bem',
                elem: 'i18n',
                keyset: 'attach',
                key: 'button-text'
            },
            noFileText : {
                block: 'i-bem',
                elem: 'i18n',
                keyset: 'attach',
                key: 'no-file'
            }
        }
sipayRT commented 10 years ago

the same problem is in the dropdown block etc. What should we do? @veged @mishanga

veged commented 10 years ago

we does not merge https://github.com/bem/bem-core/pull/514 yet — how it can work?

tadatuta commented 10 years ago

@veged the question is not about this particular block or i18n engine but about the way we write our templates. we test fields of bemjson to be isSimple to replace them with some block which content is source string in quite a few blocks already.

if we consider such approach is fine @sipayRT will rewrite them in BH and we will use same idea in new blocks but I think that as soon as we start using any i18n system it become a problem. so I just want to discuss it before we must support backward compatibility.

veged commented 10 years ago

ouch!... yep, we need to think about it...-- Сергей Бережной

On Mon, May 5, 2014 at 9:34 PM, Vladimir Grinenko notifications@github.com wrote:

@veged the question is not about this particular block or i18n engine but about the way we write our templates. we test fields of bemjson to be isSimple to replace them with some block which content is source string in quite a few blocks already.

if we consider such approach is fine @sipayRT will rewrite them in BH and we will use same idea in new blocks but I think that as soon as we start using any i18n system it become a problem. so I just want to discuss it before we must support backward compatibility.

Reply to this email directly or view it on GitHub: https://github.com/bem/bem-components/issues/448#issuecomment-42214273

deeonis commented 9 years ago

@tadatuta could you plz provide more examples of such blocks which provide strings (as i-bem__i18n do)?

deeonis commented 9 years ago

@dfilatov @narqo

veged commented 9 years ago

the best what we invent is do something like this:

    this.isSimple(button) || button.block === 'i18n' && (button = {
        block : 'button',
        tag : 'span',
        text : button
    });

but since that issue doesn't hurt anyone much I suggest to wait for better approaches

tadatuta commented 8 years ago

irrelevant since there's no support for i18n in BEMJSON in bem-core