undefined t.locale at view files
<%= t.('lang') %> method is fine
t.locale is undefined
As far as I remember it should be undefined, unless not set in controller (setLocale).
On Sat, Dec 29, 2012 at 9:27 AM, Sung Yeol Yim [email protected]:
<%= t.('lang') %> method is fine
t.locale is undefined
— Reply to this email directly or view it on GitHubhttps://github.com/1602/compound/issues/306.
thanks but i already set in controller
my debug code in setLocale method does not work because this._t is undefined
Controller.prototype.setLocale = function (locale) { if (this._t) { this._t.locale = locale; } };
I think the function "HelperSet()" in helpers.js is miss property as follow:
.. function HelperSet(ctl) { this.controller = ctl; ... this.t = ctl.t.bind(ctl);
this.t.locale = '' // HERE
...
Therefore, the view could not get the property 't.locale'
Any thoughts?
I've published fix in newest release:
diff --git a/lib/helpers.js b/lib/helpers.js
index 0182d91..f4a907f 100644
--- a/lib/helpers.js
+++ b/lib/helpers.js
@@ -55,6 +55,7 @@ function HelperSet(ctl) {
this.actionName = ctl.actionName;
this.pathTo = this.path_to = ctl.compound.routeMapper.pathTo;
this.t = ctl.t.bind(ctl);
+ this.t.locale = ctl._t && ctl._t.locale;
}