Comments (3)
That would be very useful. My white-label app needs to override some stings on server-side, but others can be used with the defaults from the RootBundle.
@Chaloemphisit Here's my draft, you may use it:
class CombinedAssetLoader extends SmartNetworkAssetLoader {
final AssetLoader parent;
CombinedAssetLoader({
required this.parent,
required super.localeUrl,
super.timeout = const Duration(seconds: 30),
required super.assetsPath,
super.localCacheDuration = const Duration(days: 1),
});
@override
Future<Map<String, dynamic>> load(String localePath, Locale locale) async {
final smartData = await super.load(localePath, locale);
final parentData = await parent.load(localePath, locale);
parentData?.addAll(smartData);
return parentData ?? {};
}
}
I could rewrite this and open a Pull Request on the easy_localization_loader
repository. Maybe create kinda class CombinedAssetLoader
extending AssetLoader, that requires arguments with base loader and override loader, and creates merged Map with localized strings.
from easy_localization.
Sorry, but i think this logic will not work for nested map.
from easy_localization.
Hmmm, that's true. I did this for my project and didn't need it :)
You need to add something like "deep merge": https://gist.github.com/niusounds/30ba030c084ccd11faaab0bf2ecd81cf
from easy_localization.
Related Issues (20)
- Triggering Easy Localization Package on iOS Language Change
- Using plural(0) count as other HOT 6
- BottomNavigationBarItem lable not change the language HOT 2
- Need callback finish EasyLocalization -> Load asset from assets/translations
- How can i create custom locals for unsupported langauges?
- How to change default "DateFormat('d').format" format HOT 1
- intl 0.19.0 doesn't work with easy_localizaiton version 3.0.5 HOT 10
- Missing features about easy localization HOT 1
- French translation Special Cahracters are not displayed correctly HOT 1
- How to set mutiple language for mutiple package in project?
- context.setLocale reverse to previous language with Easy localization HOT 1
- [Feature Request] ARB support for localization
- [Feature Request]: Support namespaces / multiple files per language
- resetLocal crashes if deviceLocale not in supportedLocales HOT 2
- ignore_for_file: constant_identifier_names when generate locale_keys.g.dart
- Localization not working on physical device
- strict countryCode problem HOT 2
- Can we generate locale keys in record form? HOT 11
- When using Icelandic (is), the automatically generated code conflicts with the keyword 'is'
- Changing system language does not effect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easy_localization.