baryshev / ect

Fastest JavaScript template engine with embedded CoffeeScript syntax
http://ectjs.com
MIT License
626 stars 69 forks source link

i18n #69

Open hueitan opened 10 years ago

hueitan commented 10 years ago

Can I get it to generate i18n?

For example I have one file index.ect

After ect process, I generate two files en/index.html fr/index.html by grabbing two different data and just using only one template index.ect

Can I do this ?

BilalBoulifa commented 9 years ago

yes it will be nice to use i18n mecanisme

ixisio commented 8 years ago

Any updates here?

ixisio commented 8 years ago

Fixed it with a helper method:

app.use(function (req, res, next) {
    res.locals.__ = function (string) {
        return i18n.__.apply(req, arguments);
    };

    next();
});

In your template files do this:

<%= @__('hello') %>

Cheers and have fun!

ixisio commented 8 years ago

@baryshev is closed!

hueitan commented 8 years ago

@ixisio What do you mean "closed"?

ixisio commented 8 years ago

@huei90 by following my example you get i18n running w/ ect...