Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enb-bem-i18n: new description #45

Closed
wants to merge 6 commits into from
Closed

enb-bem-i18n: new description #45

wants to merge 6 commits into from

Conversation

innabelaya
Copy link

Resolved #20

@innabelaya
Copy link
Author

@blond ping?

[![NPM version](http://img.shields.io/npm/v/enb-bem-i18n.svg?style=flat)](https://www.npmjs.org/package/enb-bem-i18n)
[![Build Status](http://img.shields.io/travis/enb-bem/enb-bem-i18n/master.svg?style=flat&label=tests)](https://travis-ci.org/enb-bem/enb-bem-i18n)
[![Build status](https://img.shields.io/appveyor/ci/blond/enb-bh.svg?style=flat&label=windows)](https://ci.appveyor.com/project/blond/enb-bh)
[![Coverage Status](https://img.shields.io/coveralls/enb-bem/enb-bem-i18n.svg?style=flat)](https://coveralls.io/r/enb-bem/enb-bem-i18n?branch=master)
[![devDependency Status](http://img.shields.io/david/enb-bem/enb-bem-i18n.svg?style=flat)](https://david-dm.org/enb-bem/enb-bem-i18n)

Поддержка `BEM.I18N` для ENB.
Пакет предоставляет набор ENB-технологий для сборки файлов, обеспечивающих мультиязыковую поддержку проектов, созданных на основе [БЭМ-методологии](https://ru.bem.info/method/). Осуществляет сборку BEM.i18n, использующуюся в библиотеке [bem-bl](https://ru.bem.info/libs/bem-bl/dev/).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BEM.i18n -> BEM.I18N

Теперь в поддержке не только bem-bl, но и bem-core.

Может быть не «осуществляет сборку i18n», а про то что поддерживатся i18n, который есть в bem-bl?

Или говорить именно про поддержку библиотек? Например, сделать подраздел «Поддержка библиотек», где про каждую библиотеку рассказать с её особенностью.

Сейчас история такая:

— В bem-bl есть i-bem__i18n.
— В bem-core@v2 тоже самое i-bem__i18n.
— В bem-core@v3 совсем другое, блок i18n.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давайте считать, что в bem-core@v2 сейчас никакой поддержки i18n нет и туда будет портирована история из v3

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blond есть вопрос — как писать i18n или I18N?
Правильное название i18n - в нижнем регистре. У нас в коде только в BEMHTL пишется капсом (I18N), в остальных случаях, если я не ошибаюсь, i18n.
Как понять, какой вариант писать в документации? Правильно ли, что в коде то так, то так?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Правильно в нижнем регистре — i18n. Но, если речь о реализации из bem-bl, то правильно капсом — BEM.I18N.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

про bem-core, я так понимаю, пока не пишем, раз в v2 поддержки нет, а самой v3 тоже пока нет?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет, пишем про bem-core, т.к. в 1.x уже есть поддержка нового i18n, и версия выйдет тогда, когда выйдет или bem-core@v3 или будет портировано в v2 (смотря, что раньше).

@blond
Copy link
Member

blond commented Jun 15, 2015

Написал замечаний. Про шаблоны и API технологий, давай писать после того как доделаем это в коде.

В целом мне очень нравится 👍


```js
BEM.I18N('scope', 'key'); // Ядро `i18n` предоставляется в глобальную видимость в переменную `BEM.I18N`.
// Ядро `i18n` подключается в модульную систему (YModules или CommonJS) как отдельный модуль с именем `i18n`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Второй коментарий лишний.

@innabelaya
Copy link
Author

@blond правки внесла

[ require('enb-bem-i18n/techs/i18n-merge-keysets'), { lang: 'all' } ],
[ require('enb-bem-i18n/techs/i18n-merge-keysets'), { lang: '{lang}' } ]
]);
* В `bem-bl` — в файл `all.js`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<block-name>.all.js

block1.js
block1.i18n.js # Исходный файл с переводом, содержащий
# общие переводы для всех языков.
# Может содержать ядро `i18n` для библиотеки `
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лишний перенос bem-core

**Пример**

```javascript
nodeConfig.addTech([ require('i18n-keysets-xml'), { lang: '{lang}' } ]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var KeysetsTech = require('enb-bem-i18n/techs/keysets'),
    KeysetsXMLTech = require('enb-bem-i18n/techs/keysets-xml'),
    FileProvideTech = require('enb/techs/file-provider'),
    bemTechs = require('enb-bem-techs');

module.exports = function(config) {
    config.setLanguages(['en', 'ru']);

    config.node('bundle', function(node) {
        // Получаем FileList
        node.addTechs([
            [FileProvideTech, { target: '?.bemdecl.js' }],
            [bemTechs.levels, levels: ['blocks']],
            bemTechs.deps,
            bemTechs.files
        ]);

        // Собираем keyset-файлы для каждого языка
        node.addTech([KeysetsTech, { lang: '{lang}' }]);

        // Собираем XML-файлы для каждого языка
        node.addTech([KeysetsXMLTech, { lang: '{lang}' }]);
        node.addTarget('?.keysets.{lang}.js');
    });
};

@blond
Copy link
Member

blond commented Aug 18, 2015

Closed in favor of #68

@blond blond closed this Aug 18, 2015
@blond blond removed the in progress label Aug 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants