Git Product home page Git Product logo

Comments (5)

hcodes avatar hcodes commented on June 4, 2024

Отличная идея!
Попробую разобрать и разделить правила на универсальные и привязанные к языку.

  • поменять API;
  • все перевести на английский;
  • отдельные языковые сборки.

http://practicaltypography.com/

from typograf.

hcodes avatar hcodes commented on June 4, 2024

Возможно, придется явно пробрасывать при инициализации (new Typograf(lang: 'ru')) типографа язык.
Так как по тексту определить на каком он языке написан не получится...

from typograf.

kobezzza avatar kobezzza commented on June 4, 2024

Определять в общем не надо, просто сделать удобный способ подключения / распределения и описания таких правил.


Хотя с другой стороны можно добавить фичу определения локали через атрибут lang

<p lang="ru">
    ...
</p>

или используя сервисы переводчиков (яндекс или гугл транслейт, у них есть API), но на мой взгляд такой функционал не критичен 😄

from typograf.

hcodes avatar hcodes commented on June 4, 2024
// Устанавливаем по умолчанию язык обрабатываемых текстов
var tp = new Typograf({lang: 'ru'});
tp.execute('...');

// Устанавливаем по умолчанию язык обрабатываемых текстов, но можем менять для каждого текста отдельно
var tp = new Typograf({lang: 'ru'});
tp.execute('...', {lang: 'en'});

// Если не указываем язык, то применяются только общие правила, независящие от языка
var tp = new Typograf();
tp.execute('...');

Правила раскидаю по папкам:
rules/common/html/url.js
rules/ru/money/rur.js

Будет как-то так)

from typograf.

kobezzza avatar kobezzza commented on June 4, 2024

Годно 👍

from typograf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.