flutter-form-builder-ecosystem / flutter-form-builder-ecosystem/form_builder_validators

Custom localization mismatch with the general app localizations

Open
#138 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Dart
Stars
67
Forks
106
Avg merge
2d 21h
Merged PRs (30d)
1

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Package/Plugin version

11.0.0

### Platforms

- [X] Android
- [X] iOS
- [ ] Linux
- [ ] MacOS
- [ ] Web
- [ ] Windows

### Flutter doctor

Flutter doctor

```bash
[✓] Flutter (Channel stable, 3.24.1, on macOS 14.5 23F79
darwin-arm64, locale de-DE)
• Flutter version 3.24.1 on channel stable at
/Users/faisalmohammadi/fvm/versions/stable
• Upstream repository
https://github.com/flutter/flutter.git
• Framework revision 5874a72aa4 (4 months ago),
2024-08-20 16:46:00 -0500
• Engine revision c9b9d5780d
• Dart version 3.5.1
• DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices
(Android SDK version 34.0.0)
• Android SDK at
/Users/faisalmohammadi/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME =
/Users/faisalmohammadi/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b802.4-9586694)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google
Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
• Android Studio at /Applications/Android
Studio.app/Contents
• Flutter plugin can be installed from:
🔨
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.95.3)
• VS Code at /Applications/Visual Studio
Code.app/Contents
• Flutter extension version 3.102.0

[✓] Connected device (4 available)
• iPhone 13 mini (mobile) •
7E675357-3D1E-4428-8BB7-5720CB02D06F • ios
• com.apple.CoreSimulator.SimRuntime.iOS-16-4
(simulator)
• macOS (desktop) • macos
• darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Mac Designed for iPad (desktop) •
mac-designed-for-ipad • darwin
• macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome
• web-javascript • Google Chrome 131.0.6778.109
! Error: Browsing on the local area network for
Michaels iPhone. Ensure the device is unlocked and
attached with a cable or associated with the same
local area network as this Mac.
The device must be opted into Developer Mode to
connect wirelessly. (code -27)
! Error: Browsing on the local area network for
Faisal M . Ensure the device is unlocked and
attached with a cable or associated with the same
local area network as this Mac.
The device must be opted into Developer Mode to
connect wirelessly. (code -27)

[✓] Network resources
• All expected network resources are available.

• No issues found!
```

### Minimal code example

Code sample

```dart
localizationsDelegates: const [
OverrideFormBuilderLocalizationsDe.delegate,
OverrideFormBuilderLocalizationsEn.delegate,
S.delegate,
FormBuilderLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],

supportedLocales: [
Locale('de'),
Locale('en'),
],
```

### Current Behavior

currently not possible to use both localizations in paralell. Either the general app localization not working or the form_builder_validators custom localization not working.
i created the two classes `OverrideFormBuilderLocalizationsDe` and `OverrideFormBuilderLocalizationsEn` and added it inside main.dart as its shown in the minimal code section above.

the main problem relies in the `supportedLocales` section

**like this working the form_builder_validators localization but not the general app localization**

```dart
supportedLocales: [
Locale('de'),
Locale('en'),
],
```

**like this the general app localization working but not form_builder_validators localization**

```dart
supportedLocales: [
Locale('en', 'US'),
Locale('de', 'DE'),
],
```

### Expected Behavior

using like this i expect to work both my general app localization and also my custom localization for form_builder_validators

```dart
localizationsDelegates: const [
OverrideFormBuilderLocalizationsDe.delegate,
OverrideFormBuilderLocalizationsEn.delegate,
S.delegate,
FormBuilderLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],

supportedLocales: [
Locale('en', 'US'),
Locale('de', 'DE'),
],
```

### Steps To Reproduce

1. add `form_builder_validators` package.
2. set up general app localitaion with `intl`
3. setup the custom localization for the `form_builder_validators` package by following the docs inside
4. override some fileds of `form_builder_validators`
5. add all deligates in `main.dart` as shown above in the Minimal code example
6. add supportedLocales like this

```dart
supportedLocales: [
Locale('de'),
Locale('en'),
],
```

7. run the app and check. The `form_builder_validators` works and not the general app localization
8. change the supportedLocales to this

```dart
supportedLocales: [
Locale('en', 'US'),
Locale('de', 'DE'),
],
```

9: run the app and check. The general app localization works but not `form_builder_validators`

### Aditional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.