mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-18 20:57:14 +00:00
feat: add translations
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:ndk/ndk.dart';
|
||||
|
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:amberflutter/amberflutter.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:zap_stream_flutter/i18n/strings.g.dart';
|
||||
import 'package:zap_stream_flutter/login.dart';
|
||||
import 'package:zap_stream_flutter/main.dart';
|
||||
import 'package:zap_stream_flutter/theme.dart';
|
||||
@ -22,7 +23,7 @@ class LoginPage extends StatelessWidget {
|
||||
builder: (ctx, state) {
|
||||
if (state.data ?? false) {
|
||||
return BasicButton.text(
|
||||
"Login with Amber",
|
||||
t.login.amber,
|
||||
onTap: () async {
|
||||
final amber = Amberflutter();
|
||||
final result = await amber.getPublicKey();
|
||||
@ -40,10 +41,7 @@ class LoginPage extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
BasicButton.text(
|
||||
"Login with Key",
|
||||
onTap: () => context.push("/login/key"),
|
||||
),
|
||||
BasicButton.text(t.login.key, onTap: () => context.push("/login/key")),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 20),
|
||||
height: 1,
|
||||
@ -52,7 +50,7 @@ class LoginPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
BasicButton.text(
|
||||
"Create Account",
|
||||
t.login.create,
|
||||
onTap: () => context.push("/login/new"),
|
||||
),
|
||||
],
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:zap_stream_flutter/i18n/strings.g.dart';
|
||||
import 'package:zap_stream_flutter/login.dart';
|
||||
import 'package:zap_stream_flutter/main.dart';
|
||||
import 'package:zap_stream_flutter/theme.dart';
|
||||
@ -27,7 +28,7 @@ class _LoginInputPage extends State<LoginInputPage> {
|
||||
decoration: InputDecoration(labelText: "npub/nsec"),
|
||||
),
|
||||
BasicButton.text(
|
||||
"Login",
|
||||
t.button.login,
|
||||
onTap: () async {
|
||||
try {
|
||||
if (_controller.text.startsWith("bunker://")) {
|
||||
@ -43,7 +44,7 @@ class _LoginInputPage extends State<LoginInputPage> {
|
||||
loginData.value = LoginAccount.nip19(_controller.text);
|
||||
context.go("/");
|
||||
} else {
|
||||
throw "Invalid key";
|
||||
throw t.login.error.invalid_key;
|
||||
}
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
|
@ -3,6 +3,7 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:ndk/ndk.dart';
|
||||
import 'package:ndk/shared/nips/nip01/bip340.dart';
|
||||
import 'package:ndk/shared/nips/nip01/key_pair.dart';
|
||||
import 'package:zap_stream_flutter/i18n/strings.g.dart';
|
||||
import 'package:zap_stream_flutter/login.dart';
|
||||
import 'package:zap_stream_flutter/main.dart';
|
||||
import 'package:zap_stream_flutter/theme.dart';
|
||||
@ -65,13 +66,13 @@ class _NewAccountPage extends State<NewAccountPage> {
|
||||
controller: _name,
|
||||
readOnly: _loading,
|
||||
focusNode: _nameFocus,
|
||||
decoration: InputDecoration(labelText: "Username"),
|
||||
decoration: InputDecoration(labelText: t.login.username),
|
||||
),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: _name,
|
||||
builder: (context, value, child) {
|
||||
return BasicButton.text(
|
||||
"Login",
|
||||
t.button.login,
|
||||
disabled: _loading || value.text.isEmpty,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:ndk/ndk.dart';
|
||||
import 'package:zap_stream_flutter/i18n/strings.g.dart';
|
||||
import 'package:zap_stream_flutter/imgproxy.dart';
|
||||
import 'package:zap_stream_flutter/main.dart';
|
||||
import 'package:zap_stream_flutter/rx_filter.dart';
|
||||
@ -74,7 +75,7 @@ class ProfilePage extends StatelessWidget {
|
||||
spacing: 8,
|
||||
children: [
|
||||
BasicButton.text(
|
||||
"Logout",
|
||||
t.button.logout,
|
||||
onTap: () {
|
||||
loginData.logout();
|
||||
ndk.accounts.logout();
|
||||
@ -82,7 +83,7 @@ class ProfilePage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
BasicButton.text(
|
||||
"Edit Profile",
|
||||
t.button.edit_profile,
|
||||
onTap: () {
|
||||
context.push("/settings/profile");
|
||||
},
|
||||
@ -91,7 +92,7 @@ class ProfilePage extends StatelessWidget {
|
||||
),
|
||||
if (!isMe) FollowButton(pubkey: hexPubkey),
|
||||
Text(
|
||||
"Past Streams",
|
||||
t.profile.past_streams,
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600),
|
||||
),
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:ndk/ndk.dart';
|
||||
import 'package:zap_stream_flutter/i18n/strings.g.dart';
|
||||
import 'package:zap_stream_flutter/main.dart';
|
||||
import 'package:zap_stream_flutter/theme.dart';
|
||||
import 'package:zap_stream_flutter/widgets/avatar_upload.dart';
|
||||
@ -19,7 +20,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pubkey = ndk.accounts.getPublicKey();
|
||||
if (pubkey == null) return Text("Cant edit profile when logged out");
|
||||
if (pubkey == null) return Text(t.profile.edit.error.logged_out);
|
||||
|
||||
return FutureBuilder(
|
||||
future: ndk.metadata.loadMetadata(pubkey),
|
||||
@ -51,7 +52,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
controller: _name,
|
||||
readOnly: v,
|
||||
decoration: InputDecoration(
|
||||
labelText: "Display Name",
|
||||
labelText: t.profile.edit.display_name,
|
||||
fillColor: LAYER_1,
|
||||
filled: true,
|
||||
),
|
||||
@ -60,7 +61,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
controller: _about,
|
||||
readOnly: v,
|
||||
decoration: InputDecoration(
|
||||
labelText: "About",
|
||||
labelText: t.profile.edit.about,
|
||||
fillColor: LAYER_1,
|
||||
filled: true,
|
||||
),
|
||||
@ -69,7 +70,7 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
controller: _nip5,
|
||||
readOnly: v,
|
||||
decoration: InputDecoration(
|
||||
labelText: "Nostr Address",
|
||||
labelText: t.profile.edit.nip05,
|
||||
fillColor: LAYER_1,
|
||||
filled: true,
|
||||
),
|
||||
@ -78,13 +79,13 @@ class SettingsProfilePage extends StatelessWidget {
|
||||
controller: _lud16,
|
||||
readOnly: v,
|
||||
decoration: InputDecoration(
|
||||
labelText: "Lightning Address",
|
||||
labelText: t.profile.edit.lud16,
|
||||
fillColor: LAYER_1,
|
||||
filled: true,
|
||||
),
|
||||
),
|
||||
BasicButton.text(
|
||||
"Save",
|
||||
t.button.save,
|
||||
disabled: v,
|
||||
onTap: () async {
|
||||
_loading.value = true;
|
||||
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:ndk/ndk.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
import 'package:zap_stream_flutter/i18n/strings.g.dart';
|
||||
import 'package:zap_stream_flutter/imgproxy.dart';
|
||||
import 'package:zap_stream_flutter/main.dart';
|
||||
import 'package:zap_stream_flutter/rx_filter.dart';
|
||||
@ -133,7 +134,9 @@ class _StreamPage extends State<StreamPage> with RouteAware {
|
||||
children: [
|
||||
Spacer(),
|
||||
BasicButton(
|
||||
Row(children: [Icon(Icons.bolt, size: 14), Text("Zap")]),
|
||||
Row(
|
||||
children: [Icon(Icons.bolt, size: 14), Text(t.zap.button_zap)],
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: PRIMARY_1,
|
||||
@ -166,7 +169,7 @@ class _StreamPage extends State<StreamPage> with RouteAware {
|
||||
PillWidget(
|
||||
color: LAYER_1,
|
||||
child: Text(
|
||||
"${stream.info.participants} viewers",
|
||||
t.viewers(n: stream.info.participants!),
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user