telegraf / telegraf-i18n

Internationalization middleware for Telegraf
MIT License
84 stars 31 forks source link

custom template functions #15

Closed akeinhell closed 5 years ago

akeinhell commented 6 years ago

Is it possible to add your own functions to the templates, for example pluralize.js?

example

const i18n = new telegrafI18n({
    context: {
        functions: {
            hello: (str) => `great ${str}`
        }
    }
});

template:

key:
   hello, ${hello('world')}

will be produce string hello, great world

dotcypress commented 5 years ago

@akeinhell from version 6.6.0 you can define custom functions for template engine. See example