Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with RTL formatted language mixed with Latin words #43

Open
happpyface opened this issue Aug 29, 2023 · 3 comments
Open

Issue with RTL formatted language mixed with Latin words #43

happpyface opened this issue Aug 29, 2023 · 3 comments

Comments

@happpyface
Copy link

happpyface commented Aug 29, 2023

There is a problem that I'm not sure it is related to Grammy or not.
When using RTL language text (like Persian) that has LTR words within the Latin word get reversed. example

# fa.ftl
start = سلام { $name }! چطور می‌تونم کمکت کنم؟ 

The above sentence in English is "Hello { $name}! how can i help you?"

if name is Parsa (which is loaded from ctx.from.first_name) the result must be like below:
سلام Parsa! چطور می‌تونم کمکت کنم؟
but the the result will be like this:
سلام asraP! چطور می‌تونم کمکت کنم؟

I tried the Fluent playground to check if it's related to Fluent but it's not! check the link below:
https://projectfluent.org/play/?id=2b91a538f800639b728f09d8853889e6

@roj1512
Copy link
Member

roj1512 commented Aug 29, 2023

Is its result really that or is it just your client rendering it that way?

@happpyface
Copy link
Author

Maybe this will help.
the second reply is displayed correctly in telegram.

bot.command('test', async ctx => {
  await ctx.reply(ctx.t('start', { name: 'Parsa' }))
  await ctx.reply('سلام Parsa! چطور می‌تونم کمکت کنم؟')
})

image

@dcdunkan
Copy link
Member

Do you have useIsolating set to false in the i18n/fluent configuration? It is recommended to be enabled for RTL languages. That should be why you're having this issue.

See for more information: https://github.com/projectfluent/fluent.js/wiki/Unicode-Isolation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants