You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i want try to do something like that, but i think that the service don't support it, i want use dynamic data (model) passed by a filter and later translate it.
example:
<span>In the date that you choose 12/11/2013 you will receive the package.</span>
the date '12/11/2013' is a model, so: <foo ng-model="date"></foo> <span>In the date that you choose { date | date:'medium' } you will receive the package.</span>
how i can use this service to translate this sentence? i have a dynamic value { "key": "_Message_", "value": "In the date that you choose {0} you will receive the package." }
but it should be passed by a filter first and later to the i18n filter (like the date change on fly i think that i should use the i18n filter and not the directive)
Thanks
The text was updated successfully, but these errors were encountered:
// simple translation filter
// usage {{ 'TOKEN|VAR1|VAR2'| i18n }}
.filter('i18n', ['localize', function (localize) {
return function (token) {
var values = token.split('|');
if (values.length >= 1) {
// construct the tag to insert into the element
var tag = localize.getLocalizedString(values[0]);
// update the element only if data was returned
if ((tag !== null) && (tag !== undefined) && (tag !== '')) {
if (values.length > 1) {
for (var index = 1; index < values.length; index++) {
var target = '{' + (index - 1) + '}';
tag = tag.replace(target, values[index]);
}
}
// insert the text into the element
return tag;
};
}
};
}])
{
'key' => '_ExchangeRateFrom_',
'value' => 'Exchange rate {0} from',
'description' => 'The exchange rate shown near to the calendar'
}
Hello, i want try to do something like that, but i think that the service don't support it, i want use dynamic data (model) passed by a filter and later translate it.
example:
<span>In the date that you choose 12/11/2013 you will receive the package.</span>
the date '12/11/2013' is a model, so:
<foo ng-model="date"></foo> <span>In the date that you choose { date | date:'medium' } you will receive the package.</span>
how i can use this service to translate this sentence? i have a dynamic value
{ "key": "_Message_", "value": "In the date that you choose {0} you will receive the package." }
but it should be passed by a filter first and later to the i18n filter (like the date change on fly i think that i should use the i18n filter and not the directive)
Thanks
The text was updated successfully, but these errors were encountered: