-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Internationalization/localization #374
Comments
Thank you for the warm comments, it is much appreciated. Regarding the internationalization, indeed we have not tackled this yet but we would be happy to review a PR if you want to contribute. In the meanwhile, we will keep it in our backlog |
I'd be very pleased to contribute. But I do not have any experience (yet) in creating PR's. A simple approach could be a class in the root of the widget with default English values: class Localization {
const Localization({
super.key,
this.copy = 'Copy',
this.paste = 'Paste',
..
});
final String copy;
final String paste;
..
} Then if for example the developer uses the localization package "flutter_localizations" it could be simply bound by: AppLocalizations l = AppLocalizations.of(context)!;
return FleatherEditor(
localization: Localization(
copy: l.copy,
paste: l.paste,
),
..
); The advantage would be that this package doesn't have to be aware of all the existing languages in the world. Some things to consider:
Any thoughts, suggestions? |
@Sjonnie2nd Thanks for the proposal. That looks promising and I think it's the way to go. Could you please open a PR if you're interested? |
I would benefit from this improvement, and it doesn't seem too hard. I could work on this @Amir-P. Unless you want to use this as an opportunity to discover how pull requests work, @Sjonnie2nd? |
@maelchiotti I certainly want to encourage you to pick this up. As said I have no experience in doing PR's. If I can help in some way, please let me know.. |
@maelchiotti All yours! 😉 |
I'll start looking into it when I can! |
@maelchiotti A view things to help you a little:
|
Thank you!
|
I've started to work on this, see #388. I've straight up copied the The new FleatherLocalizations(
data: FleatherLocalizationsData(...),
child: Column(
children: [
FleatherEditor(controller: controller),
FleatherToolbar.basic(controller: controller),
],
),
) If you think this is the right way to do it, then I will go ahead replace all the strings I can find. |
I'm not sure if with "you" you mean me :) but.. |
Yeah, it's great to have your feedback as a user, but indeed I'm mainly awaiting for the approval of the maintainers. Glad you think it's a good solution! |
Hey @maelchiotti. I think what you did so far looks great. But it might be better to take the Flutter's Cupertino and Material widgets localization approach. Can you take a look and see if you can make the changes? I suggest looking at |
I've looked into it @Amir-P, thank you for your input. Indeed it would be a much better and even easier solution. So I'll start working on providing localizations directly from the package with a delegate, as that would already be a big improvement, and I believe what most users would stick to. However, allowing users to provide their own translations, although a related issue, could be considered a different feature? A useful one as the PR to change the headings labels shows, but it may be easier to tackle it later, and just focus on providing "default" localizations for now. |
I've closed the old PR as the code completely changed, and I've opened a new one in #391 that now uses a delegate. I've added english and french localizations for the same strings as before. All the user needs to do is add the |
Thank you for taking the time and working on it! I will take a look at it and will continue the code review there. Regarding the extensibility, I believe we need to provide a way for users to use their own translations. Otherwise it wouldn't be a fix for the issue at hand. |
Yes, I think adding those foundations will be a great start. Then later I'll see if I want to work on enabling custom localization - I wouldn't use them myself so I don't know if I would take the time to do it. |
Closed with #391 |
At first. As a developer, wrestling for 20 years with things like contenteditable htmleditors, im very much impressed by this package.
It gives a simple, fast and robust feeling working with it.
Testing the editor in my project, and digging through te code on this repo I noticed that the vocabulary in the user interface looks mostly hard coded: "Automatic", "No color", "Normal", "Heading 1/6", "Copy", "Paste", "Select all", "Paste your url", "Apply" etc..
Am I missing something, or is there no generic builtin functionality for internationalization/localization?
Thanks in advance.
The text was updated successfully, but these errors were encountered: