Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: Set up "Direct messages" and "All messages" page titles for translation #375

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -416,5 +416,13 @@
"userRoleUnknown": "Unknown",
"@userRoleUnknown": {
"description": "Label for UserRole.unknown"
},
"recentDmConversationsPageTitle": "Direct messages",
"@recentDmConversationsPageTitle": {
"description": "Title for the page of recent DM conversations"
},
"allMessagesPageTitle": "All messages",
"@allMessagesPageTitle": {
"description": "Title for the page of all messages"
}
}
4 changes: 2 additions & 2 deletions lib/widgets/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class HomePage extends StatelessWidget {
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: const AllMessagesNarrow())),
child: const Text("All messages")),
child: Text(zulipLocalizations.allMessagesPageTitle)),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
Expand All @@ -265,7 +265,7 @@ class HomePage extends StatelessWidget {
ElevatedButton(
onPressed: () => Navigator.push(context,
RecentDmConversationsPage.buildRoute(context: context)),
child: const Text("Direct messages")),
child: Text(zulipLocalizations.recentDmConversationsPageTitle)),
if (testStreamId != null) ...[
const SizedBox(height: 16),
ElevatedButton(
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ class MessageListAppBarTitle extends StatelessWidget {

@override
Widget build(BuildContext context) {
final zulipLocalizations = ZulipLocalizations.of(context);

switch (narrow) {
case AllMessagesNarrow():
return const Text("All messages");
return Text(zulipLocalizations.allMessagesPageTitle);

case StreamNarrow(:var streamId):
final store = PerAccountStoreWidget.of(context);
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/recent_dm_conversations.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/zulip_localizations.dart';

import '../model/narrow.dart';
import '../model/recent_dm_conversations.dart';
Expand Down Expand Up @@ -53,9 +54,10 @@ class _RecentDmConversationsPageState extends State<RecentDmConversationsPage> w

@override
Widget build(BuildContext context) {
final zulipLocalizations = ZulipLocalizations.of(context);
final sorted = model!.sorted;
return Scaffold(
appBar: AppBar(title: const Text('Direct messages')),
appBar: AppBar(title: Text(zulipLocalizations.recentDmConversationsPageTitle)),
body: SafeArea(
// Don't pad the bottom here; we want the list content to do that.
bottom: false,
Expand Down
3 changes: 3 additions & 0 deletions test/widgets/recent_dm_conversations_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:checks/checks.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_gen/gen_l10n/zulip_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:zulip/api/model/events.dart';
import 'package:zulip/api/model/model.dart';
Expand Down Expand Up @@ -49,6 +50,8 @@ Future<void> setupPage(WidgetTester tester, {
await tester.pumpWidget(
GlobalStoreWidget(
child: MaterialApp(
localizationsDelegates: ZulipLocalizations.localizationsDelegates,
supportedLocales: ZulipLocalizations.supportedLocales,
navigatorObservers: navigatorObserver != null ? [navigatorObserver] : [],
home: PerAccountStoreWidget(
accountId: eg.selfAccount.id,
Expand Down
Loading