localizely / flutter-intl-intellij

This Android Studio & IntelliJ plugin generates boilerplate code for localization of Flutter apps with official Dart Intl library
MIT License
129 stars 4 forks source link

How to Add the 'use-escaping' flag in l10n.yaml When using this plugin? #106

Open jhj0517 opened 1 year ago

jhj0517 commented 1 year ago

Hello, Thank you for this plugin. It's an amazingly convenient plugin that automates almost everything I need to do for localization.

I'm struggling now because I have to escape curly braces in the .arb file like this:

'{test}'

According to this documentation and this stackoverflow post, I need to add generate: true to the pubsec.yaml file and use-escaping: true flag to the l10n.yaml file.

So, I created l10n.yaml file and placed it in the parent project directory.

arb-dir: lib\l10n
template-arb-file: intl_en.arb
use-escaping: true

However, it seems it doesn't work. Is this plugin not compatible with the l10n.yaml file?

lzoran commented 1 year ago

Hi @jhj0517,

There are several ways you can localize your Flutter app. In this post, you can find some of the approaches.

According to your config, it seems that you are using the gen_l10n tool to generate localization files, not the Flutter Intl plugin.

Hope I helped!

jhj0517 commented 1 year ago

Hi @lzoran, Thanks for the answer. I thought this plugin was integrated with the gen_l10n tool thing , but it is not.

This plugin is really convenient, but I hope that I can use the escaping syntax in the .arb file:

'{curly braces with string}'

just like the official document says here.

Since this feature is not working in the plugin, I would like to make a feature request.

philitell commented 3 weeks ago

@lzoran Is there a way to use 'use-escaping' with this plugin? I would like to include couple strings with courly braces.

lzoran commented 3 weeks ago

@philitell

The gen-l10n and Flutter Intl are two distinct tools used to generate the necessary boilerplate code for localization in Flutter applications. They should not be used simultaneously.

Regarding the use of curly braces in translations with Flutter Intl, if I remember correctly (similar issue), this should work for most cases. Could you provide an example of a message where you're encountering an issue?

philitell commented 3 weeks ago

Thank you very much - this "Hack" should work for me: https://github.com/localizely/flutter-intl-intellij/issues/106