1) How do you solve the following sentence `I received a gift from Abruzzo' '...from Marche' and '... from Lombardia' giving the fact that in the Italian language (and in many other) the result should be 'dall'Abruzzo', 'dalle Marche' and 'dalla Lombardia'?
2) What is the best way to introduce markup in the text to be translated, if possible?
Something like "I'd like to drink a Red wine" without the need to split this short sentence in three parts?
// en.json{"key":"I received a gift from {{context}}"}// it.json{"key":"Ho ricevuto un regalo da {{context}}","key_Abruzzo":"Ho ricevuto un regalo dall'Abruzzo","key_Marche":"Ho ricevuto un regalo dalle Marche","key_Lombardia":"Ho ricevuto un regalo dalla Lombardia"}// when language is italian:i18next.t('key',{context:'Abruzzo'});// Ho ricevuto un regalo dall'Abruzzoi18next.t('key',{context:'Marche'});// Ho ricevuto un regalo dalle Marchei18next.t('key',{context:'Lombardia'});// Ho ricevuto un regalo dalla Lombardiai18next.t('key',{context:'Trieste'});// Ho ricevuto un regalo da Trieste// when language is english:i18next.t('key',{context:'Abruzzo'});// I received a gift from Abruzzoi18next.t('key',{context:'Marche'});// I received a gift from Marchei18next.t('key',{context:'Lombardia'});// I received a gift from Lombardiai18next.t('key',{context:'Trieste'});// I received a gift from Trieste
Thanks Adriano, good post!
But I have a couple of questions:
1) How do you solve the following sentence `I received a gift from Abruzzo' '...from Marche' and '... from Lombardia' giving the fact that in the Italian language (and in many other) the result should be 'dall'Abruzzo', 'dalle Marche' and 'dalla Lombardia'?
2) What is the best way to introduce markup in the text to be translated, if possible?
Something like "I'd like to drink a Red wine" without the need to split this short sentence in three parts?
Thank you
Ciao Paolo!
1) I would use the context feature of i18next combined with the interpolation functionality:
2) best is to use the Trans component for this: