stream_chat_localizations 10.0.1 copy "stream_chat_localizations: ^10.0.1" to clipboard
stream_chat_localizations: ^10.0.1 copied to clipboard

The Official localizations for Stream Chat Flutter, a service for building chat applications

Official Localizations for Stream Chat Flutter #

The official localizations for Stream Chat Flutter, a service for building chat applications.

Pub CI

Quick Links

Changelog #

Check out the changelog on pub.dev to see the latest changes in the package.

Overview #

This package provides localized strings for all Stream Chat Flutter widgets. Depending on the application locale, Stream Chat widgets automatically display the appropriate language. The locale can be set automatically from system preferences or programmatically in your app.

Supported Languages #

More languages will be added in the future. Feel free to contribute to add more.

Add Dependency #

Add this to your pubspec.yaml, using the latest version Pub:

dependencies:
  stream_chat_localizations: ^10.0.0

Then run:

flutter pub get

Usage #

import 'package:flutter/material.dart';
import 'package:stream_chat_localizations/stream_chat_localizations.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // Add all the supported locales
      supportedLocales: const [
        Locale('en'),
        Locale('hi'),
        Locale('fr'),
        Locale('it'),
        Locale('es'),
        Locale('ca'),
        Locale('ja'),
        Locale('ko'),
        Locale('pt'),
        Locale('de'),
        Locale('no'),
      ],
      // Add GlobalStreamChatLocalizations.delegates
      localizationsDelegates: GlobalStreamChatLocalizations.delegates,
      builder: (context, widget) => StreamChat(
        client: client,
        child: widget,
      ),
      home: StreamChannel(
        channel: channel,
        child: const ChannelPage(),
      ),
    );
  }
}

Adding a New Language #

To add a new language, create a new class extending GlobalStreamChatLocalizations and create a delegate for it, adding it to the delegates array.

Check out this example to see how to add a new language.

Overriding Existing Languages #

To override an existing language, create a new class extending that particular language class and create a delegate for it, adding it to the delegates array.

Check out this example to see how to override an existing language.

Note on iOS #

For translations to work on iOS you need to add supported locales to ios/Runner/Info.plist as described in the Flutter docs: Localizing for iOS — updating the iOS app bundle.

Example:

<key>CFBundleLocalizations</key>
<array>
  <string>en</string>
  <string>hi</string>
  <string>fr</string>
  <string>it</string>
  <string>es</string>
  <string>ca</string>
  <string>ja</string>
  <string>ko</string>
  <string>pt</string>
  <string>de</string>
  <string>no</string>
</array>

Contributing #

We welcome code changes that improve this library or fix a problem. Please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on GitHub. Make sure to sign our Contributor License Agreement (CLA) first. See our license file for more details.

21
likes
140
points
23k
downloads

Documentation

API reference

Publisher

verified publishergetstream.io

Weekly Downloads

The Official localizations for Stream Chat Flutter, a service for building chat applications

Repository (GitHub)
View/report issues
Contributing

License

unknown (license)

Dependencies

flutter, flutter_localizations, stream_chat_flutter

More

Packages that depend on stream_chat_localizations