Comments (5)
I'm also having the same problem. I managed to solve it by getting the strings ('...'.tr()) from a non static source.
from:
class AppStrings { static String homePageTitle = 'title'.tr(); }
to:
class AppStrings { String homePageTitle = 'title'.tr(); }
from easy_localization.
I'm also having the same problem. I managed to solve it by getting the strings ('...'.tr()) from a non static source.
from:
class AppStrings { static String homePageTitle = 'title'.tr(); }
to:
class AppStrings { String homePageTitle = 'title'.tr(); }
I don't think it's a good practice, as it will make a new instance of the AppStrings class every time you call a string from it.
from easy_localization.
The solution I found to solve this error was by getting the tr() call outside the StringsManager class, and call it after the calling of the string itself like that (StringsManager.test.tr()) and it worked fine.
I think the problem was that the StringsManager class make only one instance at the beginning of the application, and it doesn't make a new one after the language changes, so the values inside it remains the same.
from easy_localization.
Use this Code,ChatGPT gives me this solution,it works!!!
- wrap your root widget with RestartWidget
- call RestartWidget.restartApp
import 'package:flutter/material.dart';
class RestartWidget extends StatefulWidget {
final Widget child;
const RestartWidget({Key? key, required this.child}) : super(key: key);
static restartApp(BuildContext context) {
context.findAncestorStateOfType<_RestartWidgetState>()?.restartApp();
}
@override
State createState() => _RestartWidgetState();
}
class _RestartWidgetState extends State<RestartWidget> {
Key key = UniqueKey();
void restartApp() {
setState(() {
key = UniqueKey();
});
}
@override
Widget build(BuildContext context) {
return KeyedSubtree(
key: key,
child: widget.child,
);
}
}
from easy_localization.
@mohamedmohamedy Duplicate of #590
from easy_localization.
Related Issues (20)
- How to use in isolate? HOT 1
- 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'
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.