Repository: flutter
Issue: Expose list of supported locales not just kWidgetsSupportedLanguages
Labels: c: new feature,framework,a: internationalization,c: proposal,P2,team-framework,triaged-framework

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Use case

While localizing we have to provide a list of supported locales using `MaterialApp.supportedLocales` which is ok if there were just a few languages or variants, but there can be many supported regions within a single language, for example Spanish has 20 country variations which can create unforeseen issues for most inexperienced developers, as an example if a developer localizes the app to Spanish and puts this as supported locales `Locale('es')` he might think it will work fine in all 20 Spanish variations/countries, since `es` will resolve all Spanish locales just for string translations but it will create issues in `NumberFormat` and `DateFormat` since in Spain the decimal point is comma `,` whereas in Mexico it is point/dot `.`
If a Mexican types `1,002.67` he means "one thousand two point six seven" whereas NumberFormat will parse it as `1.00267` which is one point ... since the default `Locale('es')` has comma as decimal point

To reproduce the issue:

1. Add to pubspec.yaml

``` yaml
  flutter_localizations:
    sdk: flutter
```

2. [Follow the steps](https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization#adding-your-own-localized-messages) to enable localization for English and Spanish

3. Set locale in Android device or emulator to Spanish Mexican

4. Run the code
<details>
  <summary>Code</summary>
 
  ```dart

import 'dart:io';
import 'package:intl/intl.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const LocalizationLanguageVariants());
}

class LocalizationLanguageVariants extends StatelessWidget {
  const LocalizationLanguageVariants({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      supportedLocales: [
        Locale.fromSubtags(languageCode: 'en', countryCode: 'US'),
        Locale.fromSubtags(languageCode: 'es'),
        // Locale.fromSubtags(languageCode: 'es', countryCode: 'MX'),
      ],
      localizationsDelegates: AppLocalizations.localizationsDelegates,
      home: AppHome(),
    );
  }
}

class AppHome extends StatelessWidget {
  const AppHome({super.key});

  @override
  Widget build(BuildContext context) {
    final appLocalizations = AppLocalizations.of(context)!;
    final helloWorld = appLocalizations.helloWorld;
    final deviceLocale = Locale(Platform.localeName);
    final deviceLocaleMessage = 'deviceLocale: $deviceLocale';
    final appLocale = Localizations.localeOf(context);
    final appLocaleMessage = 'appLocale: $appLocale';
    Intl.defaultLocale = Intl.canonicalizedLocale(appLocale.toString());

    const amount = 1002.67;
    const amountString = '1,002.67';

    final formatter = NumberFormat.decimalPatternDigits(decimalDigits: 2);
    final formattedString = formatter.format(amount);
    final formatterMessage = 'Formatter: $formatter';
    final expectedString = 'Expected formatted string $amountString, actual: $formattedString';
    final expectedParsedAmount =
        'Expected amount $amount, actual parsed: ${formatter.parse(amountString).toDouble()}';

    const userEntry = 'Example amount is one thousand two point six seven, user will type 1002.67 '
        'or 1,002.67 in Mexican spanish locale where point . is the decimal point, and '
        'comma is thousand separator';
    print('$deviceLocaleMessage\n$appLocaleMessage\n$helloWorld\n$userEntry\n$formatterMessage'
        '\n$expectedString\n$expectedParsedAmount');

    const spacer = SizedBox(height: 20);

    return Scaffold(
      appBar: AppBar(),
      body: Padding(
        padding: const EdgeInsets.all(15.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const Text(
              'Before running the App make sure to set locale in Android to Spanish Mexican',
            ),
            spacer,
            Text(deviceLocaleMessage),
            spacer,
            Text(appLocaleMessage),
            spacer,
            Text(helloWorld),
            spacer,
            const Text(userEntry),
            spacer,
            Text(formatterMessage),
            spacer,
            Text(expectedString),
            spacer,
            Text(expectedParsedAmount),
          ],
        ),
      ),
    );
  }
}
  ```
</details>

5. Example amount is one thousand two point six seven, user will type 1002.67 or 1,002.67 in Mexican Spanish locale where point . is the decimal point, and comma is thousand separator
Expected formatted string 1,002.67, actual: 1.002,67
Expected amount 1002.67, actual parsed: 1.00267
![image](https://github.com/flutter/flutter/assets/1186833/d989b6ef-0b3c-4262-b790-a45f028c8fa5)


6. To fix the issue uncomment this line in the code `Locale.fromSubtags(languageCode: 'es', countryCode: 'MX')` we are simply adding Mexican locale without adding another `es_MX` Spanish `arb` file
7. Restart the app, this time the amount should be formatted and parsed as expected in Mexican locale
![image](https://github.com/flutter/flutter/assets/1186833/903cf645-364f-4f32-891d-29d33ae7b6ab)



### Proposal

To resolve this issue user will have to either localize all 20 Spanish country variations or at least put all variations in `MaterialApp.supportedLocales`. This is just for one language, if user plans to support all 113 locale variations supported by Flutter it will be a big challenge.
What would help the developers is to have a list of all Flutter supported locales not just kWidgetsSupportedLanguages, this way the list can be provided to `MaterialApp.supportedLocales` either in full or by filtering on required language codes, it will ease the burden on developers to a large extent. This way we will need to add `arb` language variant files only when we need to localize strings.