Support for language other than english say for example arabic
Printing text in language other than english
Have you tried TTS?
Have you tried TTS?
I havent. Would you guide me on how to do this . I am fairly new to this react native thing Is there a way to change the charset encoding to utf-8 ? That might to do it
https://www.npmjs.com/package/react-native-tts
I am still in the dark here , how would a text to speech helps me in printing arabic on a thermal printer ?
Sorry. I meant google translate https://www.npmjs.com/package/google-translate-open-api
Example:
import translate from 'google-translate-open-api';
const result = await translate(`I'm fine.`, {
tld: "cn",
to: "zh-CN",
});
const data = result.data[0];
// 我很好。
or
import translate, { parseMultiple } from 'google-translate-open-api';
const result = await translate([`I'm fine. And you?`,`I'm ok.`], {
tld: "cn",
to: "zh-CN",
});
// [[[[["<i>I'm fine.</i> <b>我很好。</b> <i>And you?</i> <b>你呢?</b>"]],null,"en"],[[["我可以。"]],null,"en"]]]
// use parseMultiple
const data = result.data[0];
const parseData = parseMultiple(data);
// ["我很好。你呢?","我可以。"]
Example:
import translate from 'google-translate-open-api'; const result = await translate(`I'm fine.`, { tld: "cn", to: "zh-CN", }); const data = result.data[0]; // 我很好。or
import translate, { parseMultiple } from 'google-translate-open-api'; const result = await translate([`I'm fine. And you?`,`I'm ok.`], { tld: "cn", to: "zh-CN", }); // [[[[["<i>I'm fine.</i> <b>我很好。</b> <i>And you?</i> <b>你呢?</b>"]],null,"en"],[[["我可以。"]],null,"en"]]] // use parseMultiple const data = result.data[0]; const parseData = parseMultiple(data); // ["我很好。你呢?","我可以。"]
i went through this but here is what i want to print
const text =
'[C]' +
${print?.base_url}${print?.companyDetails?.CompanyLogo} + '\n' +
'[L]\n' +
"[C]" + print?.companyDetails?.CompanyName_Lang + "\n" +
"[C]" + print?.companyDetails?.CompanyName + "\n" +
"[C]" + address + "\n" +
'[L]\n' +
'[L]\n' +
'[C]فاتورة ضريبیة مبسطة\n' +
'[C]VAT No :' + customer?.VATNo + '\n' +
'[L]\n' ;
i want to print this in line 6 but it returns an empty line . would this be possible with the above mentioned library
You can create a function that converts text to your language and returns the converted text.
Then anywhere you want to convert print text, you call the function
You can create a function that converts text to your language and returns the converted text.
Then anywhere you want to convert print text, you call the function
i am sorry if iam in the wrong here but i have the arabic text and i would like to print it exactly like that without converting to any other langauage
'[C]فاتورة ضريبیة مبسطة\n'
this return an empty line
Then don't call the function on the line...
@Derrickkoko1234 he is asking about char encoding As this package doesn't support Arabic encoding.
any update ? @Mohamed-kassim @Roshankurikkal
any update ? @Mohamed-kassim @Roshankurikkal
I ended up capturing what i need to print as png using react native viewshot and printing that as an image using jansulo/react native bluetooth thermal printer