Use localization strings in chat settings page

parent 07c0c93d
......@@ -23,6 +23,7 @@ import 'package:pattle/src/ui/main/chat/chat_bloc.dart';
import 'package:pattle/src/ui/main/chat/settings/chat_settings_bloc.dart';
import 'package:pattle/src/ui/main/widgets/chat_name.dart';
import 'package:pattle/src/ui/main/widgets/user_item.dart';
import 'package:pattle/src/ui/resources/localizations.dart';
import 'package:pattle/src/ui/resources/theme.dart';
import 'package:pattle/src/di.dart' as di;
......@@ -109,7 +110,7 @@ class ChatSettingsPageState extends State<ChatSettingsPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Description',
l(context).description,
style: TextStyle(
color: LightColors.red,
fontSize: 16,
......@@ -117,7 +118,7 @@ class ChatSettingsPageState extends State<ChatSettingsPage> {
),
),
SizedBox(height: 4),
Text(room.topic ?? 'None',
Text(room.topic ?? l(context).none,
style: TextStyle(
fontStyle: room.topic == null
? FontStyle.italic : FontStyle.normal
......@@ -148,7 +149,7 @@ class ChatSettingsPageState extends State<ChatSettingsPage> {
Padding(
padding: EdgeInsets.only(left: 16, top: 16),
child: Text(
'${bloc.room.members.count} participants',
l(context).xParticipants(bloc.room.members.count),
style: TextStyle(
color: LightColors.red,
fontSize: 16,
......@@ -212,7 +213,7 @@ class ChatSettingsPageState extends State<ChatSettingsPage> {
Widget _buildShowMoreItem(BuildContext context, int count, bool isWaiting) {
return ListTile(
leading: Icon(Icons.keyboard_arrow_down, size: 32),
title: Text('${bloc.room.members.count - count} more'),
title: Text(l(context).xMore(bloc.room.members.count - count)),
subtitle: isWaiting ? LinearProgressIndicator() : null,
onTap: () => setState(() {
previewMembers = false;
......
......@@ -21,7 +21,6 @@ import 'package:flutter/material.dart';
Strings l(BuildContext context) => AppLocalizations.of(context).strings;
class Strings {
const Strings();
// Common //
......@@ -43,6 +42,8 @@ class Strings {
final newGroup = 'New group';
final groupName = 'Group name';
final participants = 'Participants';
final description = 'Description';
final none = 'None';
final cantSendMessages
= 'You can\'t send messages to this group because you\'re no longer a participant.';
......@@ -147,6 +148,10 @@ class Strings {
second,
TextSpan(text: ' and more typing...')
];
String xMore(int count) => '$count more';
String xParticipants(int count) => '$count participants';
}
class AppLocalizations {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment