Skip to content

Commit

Permalink
Make some hard coded strings translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
josuigoa committed Jun 17, 2024
1 parent a35eece commit 1c02426
Show file tree
Hide file tree
Showing 31 changed files with 249 additions and 103 deletions.
6 changes: 3 additions & 3 deletions lib/collections/language_codes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ abstract class LanguageLocals {
// ),
"eu": const ISOLanguageName(
name: "Basque",
nativeName: "euskara",
nativeName: "Euskara",
),
// "be": const ISOLanguageName(
// name: "Belarusian",
Expand Down Expand Up @@ -354,8 +354,8 @@ abstract class LanguageLocals {
// nativeName: "KiKongo",
// ),
"ko": const ISOLanguageName(
name: "Korean",
nativeName: "한국어 (韓國語), 조선말 (朝鮮語)",
name: "Korean",
nativeName: "한국어 (韓國語), 조선말 (朝鮮語)",
),
// "ku": const ISOLanguageName(
// name: "Kurdish",
Expand Down
9 changes: 3 additions & 6 deletions lib/components/dialogs/select_device_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ class SelectDeviceDialog extends HookConsumerWidget {
final remoteService = connectClients.asData!.value.resolvedService!;

return AlertDialog(
title: const Text("Choose the device:"),
title: Text(context.l10n.choose_the_device),
insetPadding: const EdgeInsets.all(16),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"There are multiple device connected.\n"
"Choose the device you want this action to take place",
),
Text(context.l10n.multiple_device_connected),
RadioListTile.adaptive(
title: Text(remoteService.name),
value: true,
Expand All @@ -33,7 +30,7 @@ class SelectDeviceDialog extends HookConsumerWidget {
},
),
RadioListTile.adaptive(
title: const Text("This Device"),
title: Text(context.l10n.this_device),
value: false,
groupValue: isRemoteService.value,
onChanged: (value) {
Expand Down
5 changes: 3 additions & 2 deletions lib/components/fallbacks/not_found.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:spotube/collections/assets.gen.dart';
import 'package:spotube/extensions/context.dart';

class NotFound extends StatelessWidget {
final bool vertical;
Expand All @@ -18,9 +19,9 @@ class NotFound extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Nothing found", style: theme.textTheme.titleLarge),
Text(context.l10n.nothing_found, style: theme.textTheme.titleLarge),
Text(
"The box is empty",
context.l10n.the_box_is_empty,
style: theme.textTheme.titleMedium,
),
],
Expand Down
3 changes: 2 additions & 1 deletion lib/components/playbutton_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/hover_builder.dart';
import 'package:spotube/components/image/universal_image.dart';
import 'package:spotube/extensions/constrains.dart';
import 'package:spotube/extensions/context.dart';
import 'package:spotube/hooks/utils/use_breakpoint_value.dart';
import 'package:spotube/hooks/utils/use_brightness_value.dart';

Expand Down Expand Up @@ -137,7 +138,7 @@ class PlaybuttonCard extends HookWidget {
),
if (isHovered)
Text(
"Owned by you",
context.l10n.owned_by_you,
style: theme.textTheme.bodySmall?.copyWith(
color: Colors.white,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class TrackViewHeaderActions extends HookConsumerWidget {

final auth = ref.watch(authenticationProvider);

final copiedText =
context.l10n.copied_shareurl_to_clipboard(props.shareUrl);

return Row(
mainAxisSize: MainAxisSize.min,
children: [
Expand All @@ -48,7 +51,7 @@ class TrackViewHeaderActions extends HookConsumerWidget {
width: 300,
behavior: SnackBarBehavior.floating,
content: Text(
"Copied ${props.shareUrl} to clipboard",
copiedText,
textAlign: TextAlign.center,
),
),
Expand Down
61 changes: 60 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,64 @@
"connect_client_alert": "You're being controlled by {client}",
"this_device": "This Device",
"remote": "Remote",
"stats": "Stats"
"stats": "Stats",
"recently_played": "Recently Played",
"browse_more": "Browse More",
"no_title": "No Title",
"not_playing": "Not playing",
"epic_failure": "Epic failure!",
"added_num_tracks_to_queue": "Added {tracks_length} tracks to queue",
"spotube_has_an_update": "Spotube has an update",
"download_now": "Download Now",
"nightly_version": "Spotube Nightly {nightlyBuildNum} has been released",
"release_version": "Spotube v{version} has been released",
"read_the_latest": "Read the latest ",
"release_notes": "release notes",
"pick_color_scheme": "Pick color scheme",
"save": "Save",
"choose_the_device": "Choose the device:",
"multiple_device_connected": "There are multiple device connected.\nChoose the device you want this action to take place",
"nothing_found": "Nothing found",
"the_box_is_empty": "The box is empty",
"top_tracks": "Top Tracks",
"top_artists": "Top Artists",
"top_albums": "Top Albums",
"this_week": "This week",
"this_month": "This month",
"last_6_months": "Last 6 months",
"this_year": "This year",
"last_2_years": "Last 2 years",
"all_time": "All time",
"powered_by_provider": "Powered by {providerName}",
"email": "Email",
"profile_followers": "Followers",
"birthday": "Birthday",
"country": "Country",
"subscription": "Subscription",
"not_born": "Not born",
"hacker": "Hacker",
"profile": "Profile",
"no_name": "No Name",
"edit": "Edit",
"user_profile": "User Profile",
"count_plays": "{count} plays",
"streaming_fees_hypothetical": "Streaming fees (hypothetical)",
"minutes_listened": "Minutes listened",
"streamed_songs": "Streamed songs",
"count_streams": "{count} streams",
"owned_by_you": "Owned by you",
"copied_shareurl_to_clipboard": "Copied {shareUrl} to clipboard",
"spotify_hipotetical_calculation": "*This is calculated based on Spotify's per stream\npayout of $0.003 to $0.005. This is a hypothetical\ncalculation to give user insight about how much they\nwould have paid to the artists if they were to listen\ntheir song in Spotify.",
"count_mins": "{minutes} mins",
"summary_minutes": "minutes",
"summary_listened_to_music": "Listened to music",
"summary_songs": "songs",
"summary_streamed_overall": "Streamed overall",
"summary_owed_to_artists": "Owed to artists\nthis month",
"summary_artists": "artist's",
"summary_music_reached_you": "Music reached you",
"summary_full_albums": "full albums",
"summary_got_your_love": "Got your love",
"summary_playlists": "playlists",
"summary_were_on_repeat": "Were on repeat"
}
75 changes: 67 additions & 8 deletions lib/l10n/app_eu.arb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
"always_on_top": "Beti ikusgai",
"exit_mini_player": "Irten mini erreproduzitzailetik",
"download_location": "Deskargen kokapena",
"local_library": "Liburutegi lokala",
"add_library_location": "Gehitu liburutegira",
"remove_library_location": "Kendu liburutegitik",
"account": "Kontua",
"login_with_spotify": "Hasi saioa zure Spotify kontuarekin",
"connect_with_spotify": "Spotify-rekin konektatu",
Expand All @@ -118,8 +121,8 @@
"market_place_region": "Dendaren herrialdea",
"recommendation_country": "Gomendio herrialdea",
"appearance": "Itxura",
"layout_mode": "Diseinu modua",
"override_layout_settings": "Responsive diseinu moduaren ezarpenak ezeztatu",
"layout_mode": "Diseinua",
"override_layout_settings": "Responsive diseinuaren ezarpenak ezeztatu",
"adaptive": "Moldagarria",
"compact": "Trinkoa",
"extended": "Hedatua",
Expand Down Expand Up @@ -287,14 +290,15 @@
"genres": "Generoak",
"explore_genres": "Esploratu generoak",
"friends": "Lagunak",
"no_lyrics_available": "Sentitzen dut, ezin dira kanta honen hitzak aurkitu",
"no_lyrics_available": "Sentitzen dugu, ezin dira kanta honen hitzak aurkitu",
"start_a_radio": "Hasi Irrati bat",
"how_to_start_radio": "Nola hasi nahi duzu irratia?",
"replace_queue_question": "Uneko zerrenda ordezkatu nahi duzu edo bertan gehitu?",
"endless_playback": "Amaigabeko erreprodukzioa",
"delete_playlist": "Ezabatu zerrenda",
"delete_playlist_confirmation": "Ziur zaude zerrenda ezabatu nahi duzula?",
"local_tracks": "Kanta lokalak",
"local_tab": "Lokalean",
"song_link": "Kantaren lotura",
"skip_this_nonsense": "Utzi txorakeria hau",
"freedom_of_music": "“Musika Askatasuna”",
Expand All @@ -321,9 +325,64 @@
"connect_client_alert": "{client} gailuak kontrolatzen zaitu",
"this_device": "Gailu hau",
"remote": "Urrunekoa",
"local_library": "Liburutegi lokala",
"add_library_location": "Gehitu liburutegira",
"remove_library_location": "Kendu liburutegitik",
"local_tab": "Tokiko",
"stats": "Estatistikak"
"stats": "Estatistikak",
"recently_played": "Berriki entzunak",
"browse_more": "Gehiago Bilatu",
"no_title": "Titulurik ez",
"not_playing": "Erreprodukziorik ez",
"epic_failure": "Sekulako errorea!",
"added_num_tracks_to_queue": "{tracks_length} kanta gehitu dira zerrendara",
"spotube_has_an_update": "Spotube-ren eguneraketa bat dago",
"download_now": "Orain deskargatu",
"nightly_version": "Spotube {nightlyBuildNum} Nightly-a argitaratu da",
"release_version": "Spotube v{version} argitaratu da",
"read_the_latest": "Irakurri azken ",
"release_notes": "argitatratze oharrak",
"pick_color_scheme": "Aukeratu kolore eskema",
"save": "Gorde",
"choose_the_device": "Aukeratu gailua:",
"multiple_device_connected": "Hainbat gailu daude konektatuta.\nAukeratu zein gailutan aplikatu nahi duzun ekintza hau",
"nothing_found": "Ezer ez da aurkitu",
"the_box_is_empty": "Kaxa hutsik dago",
"top_tracks": "Top Kantak",
"top_artists": "Top Artistak",
"top_albums": "Top Albumak",
"this_week": "Aste honetan",
"this_month": "Hilabete honetan",
"last_6_months": "Azken 6 hilabeteetan",
"this_year": "Aurten",
"last_2_years": "Azken 2 urtetan",
"all_time": "Betidanik",
"powered_by_provider": "{providerName}-ren eskutik",
"email": "Email",
"profile_followers": "Jarraitzaileak",
"birthday": "Jaiotze-data",
"country": "Herrialdea",
"subscription": "Harpidetzak",
"not_born": "Jaio gabe",
"hacker": "Hacker",
"profile": "Profila",
"no_name": "Izenik Ez",
"edit": "Editatu",
"user_profile": "Erabiltzaile Profila",
"count_plays": "{count} erreprodukzio",
"streaming_fees_hypothetical": "Streaming ordainketa (hipotetikoa)",
"minutes_listened": "Entzundako minutuak",
"streamed_songs": "Stream-eatutako kantak",
"count_streams": "{count} stream",
"owned_by_you": "Zure jabetzakoa",
"copied_shareurl_to_clipboard": "{shareUrl} arbelera kopiatua",
"spotify_hipotetical_calculation": "*Sportify-k stream bakoitzeko duen $0.003 eta $0.005\nordainsarian oinarritua da. Kalkulu hipotetiko bat,\nkanta hauek Spotify-n entzun bazenitu,\nberaiek artistari zenbat ordaiduko lioketen jakin dezazun.",
"count_mins": "{minutes} minutu",
"summary_minutes": "minutu",
"summary_listened_to_music": "Musika entzuten",
"summary_songs": "kanta",
"summary_streamed_overall": "Stream-eatuta oro har",
"summary_owed_to_artists": "Hilabete honetan\nartistei zor zaiena",
"summary_artists": "artisten",
"summary_music_reached_you": "Musika ailegatu zaizu",
"summary_full_albums": "album osok",
"summary_got_your_love": "Izan dute zure maitasuna",
"summary_playlists": "zerrenda",
"summary_were_on_repeat": "Dituzu errepikatze moduan"
}
5 changes: 3 additions & 2 deletions lib/modules/home/sections/feed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/horizontal_playbutton_card_view/horizontal_playbutton_card_view.dart';
import 'package:spotube/extensions/context.dart';
import 'package:spotube/pages/home/feed/feed_section.dart';
import 'package:spotube/provider/spotify/views/home.dart';
import 'package:spotube/utils/service_utils.dart';
Expand Down Expand Up @@ -33,14 +34,14 @@ class HomePageFeedSection extends HookConsumerWidget {
else if (item.playlist != null)
item.playlist!.asPlaylist
],
title: Text(section.title ?? "No Titel"),
title: Text(section.title ?? context.l10n.no_title),
hasNextPage: false,
isLoadingNextPage: false,
onFetchMore: () {},
titleTrailing: Directionality(
textDirection: TextDirection.rtl,
child: TextButton.icon(
label: const Text("Browse More"),
label: Text(context.l10n.browse_more),
icon: const Icon(SpotubeIcons.angleRight),
onPressed: () => ServiceUtils.pushNamed(
context,
Expand Down
3 changes: 2 additions & 1 deletion lib/modules/home/sections/friends.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:skeletonizer/skeletonizer.dart';
import 'package:spotube/collections/fake.dart';
import 'package:spotube/modules/home/sections/friends/friend_item.dart';
import 'package:spotube/extensions/context.dart';
import 'package:spotube/hooks/utils/use_breakpoint_value.dart';
import 'package:spotube/models/spotify_friends.dart';
import 'package:spotube/provider/authentication_provider.dart';
Expand Down Expand Up @@ -73,7 +74,7 @@ class HomePageFriendsSection extends HookConsumerWidget {
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Friends',
context.l10n.friends,
style: Theme.of(context).textTheme.titleMedium,
),
),
Expand Down
3 changes: 2 additions & 1 deletion lib/modules/home/sections/recent.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/components/horizontal_playbutton_card_view/horizontal_playbutton_card_view.dart';
import 'package:spotube/extensions/context.dart';
import 'package:spotube/provider/history/recent.dart';
import 'package:spotube/provider/history/state.dart';

Expand All @@ -16,7 +17,7 @@ class HomeRecentlyPlayedSection extends HookConsumerWidget {
}

return HorizontalPlaybuttonCardView(
title: const Text('Recently Played'),
title: Text(context.l10n.recently_played),
items: [
for (final item in history)
if (item is PlaybackHistoryPlaylist)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class _MultiSelectDialog<T> extends HookWidget {

return AlertDialog(
scrollable: true,
title: dialogTitle ?? const Text('Select'),
title: dialogTitle ?? Text(context.l10n.select),
contentPadding: mediaQuery.mdAndUp ? null : const EdgeInsets.all(16),
insetPadding: const EdgeInsets.all(16),
actions: [
Expand Down
3 changes: 2 additions & 1 deletion lib/modules/player/player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ class PlayerView extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AutoSizeText(
currentTrack?.name ?? "Not playing",
currentTrack?.name ??
context.l10n.not_playing,
style: TextStyle(
color: titleTextColor,
fontSize: 22,
Expand Down
5 changes: 3 additions & 2 deletions lib/modules/playlist/playlist_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotify/spotify.dart';
import 'package:spotube/components/dialogs/select_device_dialog.dart';
import 'package:spotube/components/playbutton_card.dart';
import 'package:spotube/extensions/context.dart';
import 'package:spotube/extensions/image.dart';
import 'package:spotube/models/connect/connect.dart';
import 'package:spotube/pages/playlist/playlist.dart';
Expand Down Expand Up @@ -132,8 +133,8 @@ class PlaylistCard extends HookConsumerWidget {
historyNotifier.addPlaylists([playlist]);
if (context.mounted) {
final snackbar = SnackBar(
content:
Text("Added ${fetchedInitialTracks.length} tracks to queue"),
content: Text(context.l10n
.added_num_tracks_to_queue(fetchedInitialTracks.length)),
action: SnackBarAction(
label: "Undo",
onPressed: () {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/playlist/playlist_create_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class PlaylistCreateDialog extends HookConsumerWidget {
scaffold.showSnackBar(
SnackBar(
content: Text(
l10n.error(error.message ?? "Epic failure!"),
l10n.error(error.message ?? context.l10n.epic_failure),
style: theme.textTheme.bodyMedium!.copyWith(
color: theme.colorScheme.onError,
),
Expand Down
Loading

0 comments on commit 1c02426

Please sign in to comment.