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

Improving on HttpAssetLoader #49

Merged
merged 26 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8a9837b
Update README.md
Frankdroid7 Apr 19, 2023
faf8b48
chore(): upgraded deps
le-vlad May 19, 2023
20b917d
chore(): load concrete location
le-vlad May 19, 2023
b1fe112
fix(): correct decoding of cyrillic chars
le-vlad May 19, 2023
2b6c0be
chore(): updated readme. added HttpAssetLoader doc
le-vlad May 19, 2023
3d9edbd
fix(doc): update dir structure
le-vlad May 19, 2023
b24e85c
Delete local AssetLoader class, update dependencies (#46)
alexeyinkin Jun 26, 2023
93f83d9
Undo the breaking change of file names (#46)
alexeyinkin Jun 27, 2023
efca208
Merge pull request #50 from alexeyinkin/issue46_update-dependencies
bw-flagship Jul 4, 2023
8fea719
contributing.md
bw-flagship Sep 29, 2023
c484454
added pipelines
bw-flagship Sep 29, 2023
897ed8d
fix linting problems
bw-flagship Sep 29, 2023
3407c17
changelog
bw-flagship Sep 29, 2023
3bf6e59
devversion
bw-flagship Sep 29, 2023
8e60e2e
execute now
bw-flagship Sep 29, 2023
eaa2da1
revert temp changes
bw-flagship Sep 29, 2023
edb9c5c
Add Release pipeline
bw-flagship Sep 29, 2023
6cfc31a
Fix Typos
bw-flagship Sep 29, 2023
5f5139f
update connectivity_plus, easy_localization, http and path_provider p…
AbdulazizRasulbek Oct 26, 2023
7c4abf7
Merge pull request #56 from AbdulazizRasulbek/master
bw-flagship Oct 26, 2023
f0be467
chore(): upgraded deps
le-vlad May 19, 2023
8be6742
chore(): load concrete location
le-vlad May 19, 2023
08fdb68
fix(): correct decoding of cyrillic chars
le-vlad May 19, 2023
79a8969
chore(): updated readme. added HttpAssetLoader doc
le-vlad May 19, 2023
65d79ba
fix(doc): update dir structure
le-vlad May 19, 2023
dde7542
Merge branch 'master' of github.com:wewego-co/easy_localization_loader
le-vlad Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*.ipr
*.iws
.idea/
.vscode/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,20 @@ void main(){
...
```

3. All done!.
3. All done!.


### Loaders Specification

#### HttpAssetLoader

In order to use HttpAssetLoader you must provide a path to a folder (i.e. base path) where all your translations are placed like `https://example.com/translations`

Your translations should be created as separate files with `.json` extension. Placing translations as individual files reduces the size of the file to load on application init.
Example:

```
translations/
├── en-US.json
└── uk-UA.json
```
4 changes: 2 additions & 2 deletions lib/src/http_asset_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class HttpAssetLoader extends AssetLoader {
Future<Map<String, dynamic>> load(String path, Locale locale) async {
log('easy localization loader: load http $path');
try {
var url = Uri.parse(path);
var url = Uri.parse('$path/${locale.toLanguageTag()}.json');
return http
.get(url)
.then((response) => json.decode(response.body.toString()));
.then((response) => json.decode(utf8.decode(response.bodyBytes)));
} catch (e) {
//Catch network exceptions
return Future.value();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
xml: ^6.1.0
flutter:
sdk: flutter
connectivity_plus: ^2.3.7
connectivity_plus: ^3.0.2
path_provider: ^2.0.11

dev_dependencies:
Expand Down