Skip to content

Commit

Permalink
i18n: Set up "Direct messages" page title for translation
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe authored and gnprice committed Feb 6, 2024
1 parent a0f4462 commit 880a0fe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -416,5 +416,9 @@
"userRoleUnknown": "Unknown",
"@userRoleUnknown": {
"description": "Label for UserRole.unknown"
},
"recentDmConversationsPageTitle": "Direct messages",
"@recentDmConversationsPageTitle": {
"description": "Title for the page of recent DM conversations"
}
}
2 changes: 1 addition & 1 deletion lib/widgets/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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/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

0 comments on commit 880a0fe

Please sign in to comment.