SankethBK / diaryvault

A personal diary application written in Flutter
https://play.google.com/store/apps/details?id=me.sankethbk.dairyapp
MIT License
108 stars 71 forks source link

Add multi-language support #17

Closed SankethBK closed 1 year ago

SankethBK commented 1 year ago

Use flutter_localizations / l10n for adding multi-language support. Currently hardcoded strings are scattered throughout the app, need to find them and translations.

By default it should use language as device's language. If the device's language is not supported, English should be used.

bibekpanda55 commented 1 year ago

I can work on this

SankethBK commented 1 year ago

Hey @bibekpanda55 , @micedreams is working on this. we have some more open issues, see if you can pick any. You can raise new issues if you find any bug, or have ideas for enhancement or new features

micedreams commented 1 year ago

@bibekpanda55 you can take it....

SankethBK commented 1 year ago

Sure, assigning this to you @bibekpanda55

bibekpanda55 commented 1 year ago

Thanks for assigning the issue . Will work on it and create a PR asap. If you just elaborate on the steps to follow that would help.

SankethBK commented 1 year ago

@bibekpanda55 you can find the detailed guide here: https://docs.flutter.dev/ui/accessibility-and-localization/internationalization.

For changing language from within the app, i will add more details. (I will create separate issue for this as it could be too much code)

For this issue, we can just add support for english, we can add more languages later.

SankethBK commented 1 year ago

Adding the steps for reference.

  1. Add flutter_localizations and intl packages.
  2. Add localizationsDelegates and add Locale('en') to supportedLocales array
  3. Create /lib/l10n folder at the root of the project. Create app_en.arb and extract out all hardcoded strings throughout the code into this file.
  4. Replace hardcoded strings with their corresponding keys from arb file

Feel free to join our discord server if you need help with anything

bibekpanda55 commented 1 year ago

Thanks for the description. Will work on it and get back to you.Also will I have to create a separate branch for this or work on the master branch itself. Also there are already a few bugs on the main branch right?

SankethBK commented 1 year ago

you can fork the repo, make changes to your master branch and raise PR against this repo's master branch.

Also there are already a few bugs on the main branch right?

you mean bugs related to setup?

SankethBK commented 1 year ago

@bibekpanda55 please confirm if you're working on this

bibekpanda55 commented 1 year ago

Yes have been busy lately. Will work on it and give you an update by tomorrow

SankethBK commented 1 year ago

No worries, thanks for confirming

bibekpanda55 commented 1 year ago

you mean bugs related to setup?

Yes some packages are missing from the flutter_quill folder like the html,image_picker etc. Should I all that to pubspec.yaml file or what?

micedreams commented 1 year ago

you mean bugs related to setup?

Yes some packages are missing from the flutter_quill folder like the html,image_picker etc. Should I all that to pubspec.yaml file or what?

Hi, this feels unrelated to this issue. Please raise a new issue.

SankethBK commented 1 year ago

Could be because of Flutter version, can you please share the output of flutter doctor command

SankethBK commented 1 year ago

Those packages are added in flutter_quill's pubspec.yaml, we don't need to add them to root folder's pubspec.yaml. Let us know If you are facing any issues on running flutter pub get and flutter run

bibekpanda55 commented 1 year ago

Flutter doctor doesn't shows any issues . You can check the packages/flutter_quill/flutter_quill_extensions/lib/embeds/toolbar/image_button.dart file for example

SankethBK commented 1 year ago

Try running flutter pub get, it should install those packages. I don't see any errors in the file you mentioned

SankethBK commented 1 year ago

Flutter doctor doesn't shows any issues

Can you share the output of flutter --version, some packages depend on the Flutter version

bibekpanda55 commented 1 year ago

I was running pub get on the outside folder , so there were package issues.The issue got resolved after running pub get in the required folder. Thanks for helping out

SankethBK commented 1 year ago

Thanks for sharing, we'll add it in setup instructions

bibekpanda55 commented 1 year ago

Also if you could specify few files or overall folder to extract the raw strings from that would help.As there are too may folders that's creating a bit confusion

SankethBK commented 1 year ago

@bibekpanda55 you can do a global search with this regex Text\(['|"].* and exclude the packages/ folder.

image
bibekpanda55 commented 1 year ago

Got it thanks will do

bibekpanda55 commented 1 year ago
  1. Added flutter_localizations and intl packages.
  2. Added localizationsDelegates and add Locale('en') to supportedLocales array
  3. Created /lib/l10n folder at the root of the project. Create app_en.arb and extracted out all hardcoded strings throughout the code into this file.
  4. Replaced hardcoded strings with their corresponding keys from arb file. Have created a PR for closing this issue. Please check and merge the PR if you don't find any further issues.