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

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

Official Localizations for Stream Chat Flutter library. #

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.

localization_support

What is Localization? #

If you deploy your app to users who speak another language, you'll need to internationalize (localize) it. That means you need to write the app in a way that makes it possible to localize values like text and layouts for each language or locale that the app supports. For more information, see the Flutter documentation.

What this package allows you to do is to provide localized strings for the Stream chat widgets. For example, depending on the application locale, the Stream Chat widgets will display the appropriate language. The locale will be set automatically, based on system preferences, or you could set it programmatically in your app. The package supports several different languages, with more to be added. The package allows you to override any supported language or add a new language that isn't supported.

Supported languages #

At the moment we support the following languages:

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

Add dependency #

Add this to your package's pubspec.yaml file, use the latest version Pub

dependencies:
 stream_chat_localizations: ^latest_version

Then run flutter packages 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.

Override 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 translation to work on iOS you need to add supported locales to ios/Runner/Info.plist as described here.

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. We are pleased to merge your code into the official repository. Make sure to sign our Contributor License Agreement (CLA) first. See our license file for more details.

18
likes
140
pub points
92%
popularity

Publisher

verified publishergetstream.io

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

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

unknown (license)

Dependencies

flutter, flutter_localizations, stream_chat_flutter

More

Packages that depend on stream_chat_localizations