I did not add a few messages to the .arb files as the general syntax is to use S.of(context).getter while a few messages that required translations were present outside a widget and hence I could not use .of(context) for such messages. (Still figuring this out) (in a nutshell: cannot translate text present outside a widget)
Added support for hindi(hi) - the only other language I can read
Used the VS Code Flutter Intl extension. Easier to write translations. Demo
The output localization file is called S.dart as the extension as seen in the demo replaces the highlighted text with S.context(of)...
Now will be easy to add translations for other languages. (Copy the template from one of the .arb files and change the value of the key-value pair)
Better to use the extension to create/delete arb files. Easier as it updates all the files whenever you replace text with S.context(of)... as seen in the demo.
Possible improvement: Reduce mappings in the arb files by identifying the plural of a word. For example, now I have separate mappings for repository and repositories
Can I update contributing.md with steps to follow in case anyone wants to add translation for a language? (They only have to use the extension and translate the messages in the arb file)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/pd4d10/git-touch/pull/137
**Author:** [@shreyas1599](https://github.com/shreyas1599)
**Created:** 12/31/2020
**Status:** ✅ Merged
**Merged:** 1/5/2021
**Merged by:** [@pd4d10](https://github.com/pd4d10)
**Base:** `main` ← **Head:** `localization`
---
### 📝 Commits (2)
- [`4829684`](https://github.com/pd4d10/git-touch/commit/48296844aa101c8fd3a7ada5170c34572787052d) feat: localization
- [`60381a0`](https://github.com/pd4d10/git-touch/commit/60381a039eec4d4ae6b8d6c31c1b60c6f6f5b886) update
### 📊 Changes
**66 files changed** (+1988 additions, -168 deletions)
<details>
<summary>View changed files</summary>
📝 `ios/Podfile.lock` (+1 -1)
📝 `ios/Runner.xcodeproj/project.pbxproj` (+4 -17)
📝 `ios/Runner/Info.plist` (+5 -0)
➕ `l10n.yaml` (+3 -0)
📝 `lib/app.dart` (+30 -0)
➕ `lib/generated/intl/messages_all.dart` (+66 -0)
➕ `lib/generated/intl/messages_en.dart` (+127 -0)
➕ `lib/generated/intl/messages_hi.dart` (+130 -0)
➕ `lib/generated/l10n.dart` (+947 -0)
📝 `lib/home.dart` (+29 -16)
➕ `lib/l10n/intl_en.arb` (+354 -0)
➕ `lib/l10n/intl_hi.arb` (+91 -0)
📝 `lib/screens/bb_commits.dart` (+2 -1)
📝 `lib/screens/bb_explore.dart` (+2 -1)
📝 `lib/screens/bb_issues.dart` (+2 -1)
📝 `lib/screens/bb_pulls.dart` (+2 -1)
📝 `lib/screens/bb_repo.dart` (+2 -1)
📝 `lib/screens/bb_teams.dart` (+2 -1)
📝 `lib/screens/code_theme.dart` (+8 -7)
📝 `lib/screens/ge_blob.dart` (+2 -1)
_...and 46 more files_
</details>
### 📄 Description
#119
- I did not add a few messages to the .arb files as the general syntax is to use `S.of(context).getter` while a few messages that required translations were present outside a widget and hence I could not use `.of(context)` for such messages. (Still figuring this out) _(in a nutshell: cannot translate text present outside a widget)_
- Added support for hindi(hi) - the only other language I can read
- Used the VS Code `Flutter Intl` extension. Easier to write translations. [Demo](https://twitter.com/localizely/status/1255175275454881793)
- The output localization file is called `S.dart` as the extension as seen in the demo replaces the highlighted text with `S.context(of)...`
- Now will be easy to add translations for other languages. (Copy the template from one of the .arb files and change the value of the key-value pair)
- Better to use the extension to create/delete arb files. Easier as it updates all the files whenever you replace text with `S.context(of)...` as seen in the demo.
- _Possible improvement_: Reduce mappings in the arb files by identifying the plural of a word. For example, now I have separate mappings for repository and repositories
- Can I update `contributing.md` with steps to follow in case anyone wants to add translation for a language? (They only have to use the extension and translate the messages in the arb file)
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/pd4d10/git-touch/pull/137
Author: @shreyas1599
Created: 12/31/2020
Status: ✅ Merged
Merged: 1/5/2021
Merged by: @pd4d10
Base:
main← Head:localization📝 Commits (2)
4829684feat: localization60381a0update📊 Changes
66 files changed (+1988 additions, -168 deletions)
View changed files
📝
ios/Podfile.lock(+1 -1)📝
ios/Runner.xcodeproj/project.pbxproj(+4 -17)📝
ios/Runner/Info.plist(+5 -0)➕
l10n.yaml(+3 -0)📝
lib/app.dart(+30 -0)➕
lib/generated/intl/messages_all.dart(+66 -0)➕
lib/generated/intl/messages_en.dart(+127 -0)➕
lib/generated/intl/messages_hi.dart(+130 -0)➕
lib/generated/l10n.dart(+947 -0)📝
lib/home.dart(+29 -16)➕
lib/l10n/intl_en.arb(+354 -0)➕
lib/l10n/intl_hi.arb(+91 -0)📝
lib/screens/bb_commits.dart(+2 -1)📝
lib/screens/bb_explore.dart(+2 -1)📝
lib/screens/bb_issues.dart(+2 -1)📝
lib/screens/bb_pulls.dart(+2 -1)📝
lib/screens/bb_repo.dart(+2 -1)📝
lib/screens/bb_teams.dart(+2 -1)📝
lib/screens/code_theme.dart(+8 -7)📝
lib/screens/ge_blob.dart(+2 -1)...and 46 more files
📄 Description
#119
S.of(context).getterwhile a few messages that required translations were present outside a widget and hence I could not use.of(context)for such messages. (Still figuring this out) (in a nutshell: cannot translate text present outside a widget)Flutter Intlextension. Easier to write translations. DemoS.dartas the extension as seen in the demo replaces the highlighted text withS.context(of)...S.context(of)...as seen in the demo.contributing.mdwith steps to follow in case anyone wants to add translation for a language? (They only have to use the extension and translate the messages in the arb file)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.