WebReflection / lighterhtml

The hyperHTML strength & experience without its complexity 🎉
https://medium.com/@WebReflection/lit-html-vs-hyperhtml-vs-lighterhtml-c084abfe1285
ISC License
735 stars 20 forks source link

how should I use i18n-node with lighterhtml? [help] #31

Closed kxrom closed 5 years ago

kxrom commented 5 years ago

About i18n-node, where should I register __() to be used within lighterhtml templates?

This is an example implementation for handlebarsjs.com template engine:

// register hbs helpers in res.locals' context which provides this.locale
hbs.registerHelper('__', function () {
  return i18n.__.apply(this, arguments);
});
hbs.registerHelper('__n', function () {
  return i18n.__n.apply(this, arguments);
});
WebReflection commented 5 years ago

lighterhtml is not compatible with node (meaning: it doesn't do SSR)

to use i18n with anything, just use it normally

html`<div>${i18n`my content`}</div>`