const root = new Ractive({
el: 'root',
components: {
Decorator
},
template: `
<Decorator>
<div>Got the value: {{source['key']}}</div>
<div>Got the value: {{source['bob']}}</div>
</Decorator>
`
})
const Decorator = Ractive.extend({
template: '{{>content}}',
computed: {
source() {
const obj = {
get key() { //Just to test
return 'I know this key';
},
get ['expr']() { //How to know the expr ?
return `I don't know this key ${IsThereAWayToKnowWhatPropertyWeWereTryingToAccess}`;
}
};
return obj;
}
}
});--
You received this message because you are subscribed to the Google Groups "Ractive.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ractive-js+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
i18next.init({
lng: 'en',
resources: {
en: {
translation: {
"key": "hello world"
}
},
fr: {
translation: {
"key": "salut le monde"
}
}
}
});
Ractive.components.I18nextDecorator = Ractive.extend({
template: '{{>content}}',
data() {
return {
language: i18next.language,
translate(key) {
return i18next.t(key);
}
}
}
});const root = new Ractive({
el: 'root',
template: `
<I18nextDecorator>
<div>Key1: {{translate('key')}}</div>
</I18nextDecorator>
`
})
Thanks, Chris
To unsubscribe from this group and stop receiving emails from it, send an email to ractive-js+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ractive-js+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ractive-js+unsubscribe@googlegroups.com.