Closed UnrealView closed 1 year ago
I finally found a cool solution and I share my idea here. Note, I build my own i18n system.
In this example, the var _i18n
store the function permit to retrieve the value from the key:
- var _i18n = i18n.GetInstance().Get
//...
p i18n test [error.NotFirstLaunch] - #{_i18n("error.NotFirstLaunch")}
p i18n test [view.index.day, 10] - #{_i18n("view.index.day", 10)}
p i18n test [view.index.day, 1] - #{_i18n("view.index.day", 1)}
Possible output:
i18n test [error.NotFirstLaunch] - This is not the first launch.
i18n test [view.index.day, 10] - 10 days left
i18n test [view.index.day, 1] - 1 day left
First of all, thank you for your project!
After several tests, I am interested in the internationalization process and I'm currently stuck.
Based on pugjs doc, I thought that filters is an option to implement an i18n. But I can't find a way to implement my own filter. It seems that the test
filters.jade
doesn't work in terms of output. When I see theparseFilter
function with a switch I assume is not built to be extended.Is there another solution to my problem? Am I misusing the filters functions?