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

Tidy up i18n file #200

Merged
merged 1 commit into from
Sep 9, 2022
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
2 changes: 1 addition & 1 deletion app/models/album.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Album < ApplicationRecord
search_by :name, associations: :artist

def title
is_unknown? ? I18n.t("text.unknown_album") : name
is_unknown? ? I18n.t("label.unknown_album") : name
end

def is_unknown?
Expand Down
4 changes: 2 additions & 2 deletions app/models/artist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class Artist < ApplicationRecord
search_by :name

def title
return I18n.t("text.various_artists") if is_various?
return I18n.t("text.unknown_artist") if is_unknown?
return I18n.t("label.various_artists") if is_various?
return I18n.t("label.unknown_artist") if is_unknown?

name
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/albums/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<% content_for :title do %>
<%= t('text.edit_album') %>
<%= t('label.edit_album') %>
<% end %>

<%= form_with model: @album, data: { turbo_frame: '_top', test_id: 'album_edit_form' }, class: 'c-form' do |form| %>
<div class='c-form__field'>
<%= form.label :image, t('text.album_cover') %>
<%= form.label :image, t('label.album_cover') %>
<%= form.file_field :image, accept: 'image/png, image/jpeg', class: 'c-input' %>
</div>
<div class='c-form__field c-form__field--submit'>
Expand Down
2 changes: 1 addition & 1 deletion app/views/albums/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<% end %>

<%= link_to dialog_playlists_path(song_id: song.id), data: { turbo_frame: 'turbo-dialog', test_id: 'album_song_add_playlist' } do %>
<%= icon_tag 'playlist-add', size: 'small', title: t('text.add_to_playlist') %>
<%= icon_tag 'playlist-add', size: 'small', title: t('label.add_to_playlist') %>
<% end %>
</div>
</li>
Expand Down
4 changes: 2 additions & 2 deletions app/views/artists/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<% content_for :title do %>
<%= t('text.edit_artist') %>
<%= t('label.edit_artist') %>
<% end %>

<%= form_with model: @artist, data: { turbo_frame: '_top', test_id: 'artist_edit_form' }, class: 'c-form' do |form| %>
<div class='c-form__field'>
<%= form.label :image, t('text.artist_cover') %>
<%= form.label :image, t('label.artist_cover') %>
<%= form.file_field :image, accept: 'image/png, image/jpeg', class: 'c-input' %>
</div>
<div class='c-form__field c-form__field--submit'>
Expand Down
2 changes: 1 addition & 1 deletion app/views/dialog/playlists/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :title do %>
<%= t('text.add_to_playlist') %>
<%= t('label.add_to_playlist') %>
<% end %>

<% if @playlists.present? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/playlists/songs/_song.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<details class='c-dropdown' data-test-id='playlist_song_menu'>
<summary><%= icon_tag 'more-vertical', size: 'small', title: t('label.more') %></summary>
<div class='c-dropdown__list'>
<%= link_to t('text.add_to_playlist'), dialog_playlists_path(song_id: song.id), data: { turbo_frame: 'turbo-dialog' }, class: 'c-dropdown__item' %>
<%= link_to t('label.add_to_playlist'), dialog_playlists_path(song_id: song.id), data: { turbo_frame: 'turbo-dialog' }, class: 'c-dropdown__item' %>
<%= button_to t('label.delete'), playlist_songs_path(playlist, song_id: song.id), method: :delete, form_class: 'c-dropdown__item', form: { 'data-submit-end-action' => 'delete' } %>
</div>
</details>
Expand Down
8 changes: 4 additions & 4 deletions app/views/search/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h2 class='u-mb-0'><%= t('label.albums') %></h2>

<% unless @is_all_albums %>
<%= link_to t('text.see_all'), search_albums_path(query: params[:query]), class: 'is-active' %>
<%= link_to t('label.see_all'), search_albums_path(query: params[:query]), class: 'is-active' %>
<% end %>
</div>
<div class='o-grid o-grid--shelf u-mb-large'>
Expand All @@ -19,7 +19,7 @@
<h2 class='u-mb-0'><%= t('label.artists') %></h2>

<% unless @is_all_artists %>
<%= link_to t('text.see_all'), search_artists_path(query: params[:query]), class: 'is-active' %>
<%= link_to t('label.see_all'), search_artists_path(query: params[:query]), class: 'is-active' %>
<% end %>
</div>
<div class='o-grid o-grid--shelf u-mb-large'>
Expand All @@ -32,7 +32,7 @@
<h2 class='u-mb-0'><%= t('label.playlists') %></h2>

<% unless @is_all_playlists %>
<%= link_to t('text.see_all'), search_playlists_path(query: params[:query]), class: 'is-active' %>
<%= link_to t('label.see_all'), search_playlists_path(query: params[:query]), class: 'is-active' %>
<% end %>
</div>
<div class='o-grid o-grid--list u-mb-wide'>
Expand All @@ -45,7 +45,7 @@
<h2 class='u-mb-0'><%= t('label.songs') %></h2>

<% unless @is_all_songs %>
<%= link_to t('text.see_all'), search_songs_path(query: params[:query]), class: 'is-active' %>
<%= link_to t('label.see_all'), search_songs_path(query: params[:query]), class: 'is-active' %>
<% end %>
</div>
<%= render partial: 'search/songs/table', locals: { songs: @songs } %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/settings/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id='turbo-settings'>
<h2><%= t('text.media_path') %></h2>
<h2><%= t('label.media_path') %></h2>
<%= render 'settings/media_path_form' %>

<hr />
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_empty_alert.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<%= icon_tag 'music-off', large: 'large' %>
</div>
<% end %>
<p><%= t('text.no_items') %></p>
<p><%= t('label.no_items') %></p>
</div>
<% if has_overlay %></div><% end %>
8 changes: 4 additions & 4 deletions app/views/shared/_mini_player.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div id='js-mini-player' class='c-player o-flex o-flex--justify-between o-flex--align-center u-p-narrow' data-controller='mini-player' data-turbo-permanent>
<div data-action='click->mini-player#expand' class='o-flex o-flex--align-center o-flex__item--grow-1 u-w-0'>
<span class='u-mr-narrow'><%= icon_tag 'expand-less', size: 'large', title: t('text.expand_player') %></span>
<span class='u-mr-narrow'><%= icon_tag 'expand-less', size: 'large', title: t('label.expand_player') %></span>
<span data-mini-player-target='songName' class='u-text-truncate'></span>
<span data-mini-player-target='loader' class='u-display-none'><%= loader_tag(size: 'small') %></span>
</div>
<div class='o-flex o-flex--justify-between '>
<span data-action='click->mini-player#play' class='u-mx-small u-cursor-pointer' data-mini-player-target='playButton'><%= icon_tag 'play', size: 'large', title: t('text.play_song') %></span>
<span data-action='click->mini-player#pause' class='u-mx-small u-cursor-pointer u-display-none' data-mini-player-target='pauseButton'><%= icon_tag 'pause', size: 'large', title: t('text.pause_song') %></span>
<span data-action='click->mini-player#next' class='u-cursor-pointer'><%= icon_tag 'fast-forward', size: 'large', title: t('text.next_song') %></span>
<span data-action='click->mini-player#play' class='u-mx-small u-cursor-pointer' data-mini-player-target='playButton'><%= icon_tag 'play', size: 'large', title: t('label.play_song') %></span>
<span data-action='click->mini-player#pause' class='u-mx-small u-cursor-pointer u-display-none' data-mini-player-target='pauseButton'><%= icon_tag 'pause', size: 'large', title: t('label.pause_song') %></span>
<span data-action='click->mini-player#next' class='u-cursor-pointer'><%= icon_tag 'fast-forward', size: 'large', title: t('label.next_song') %></span>
</div>
</div>
20 changes: 10 additions & 10 deletions app/views/shared/_player.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,34 @@
</div>
<div class='u-px-small u-py-medium o-flex o-flex--justify-between o-flex--align-center c-player__control'>
<div class='u-cursor-pointer' data-action='click->player#nextMode'>
<span data-player-target='modeButton'><%= icon_tag 'repeat', title: t('text.repeat_mode') %></span>
<span data-player-target='modeButton'><%= icon_tag 'repeat-one', title: t('text.single_mode') %></span>
<span data-player-target='modeButton'><%= icon_tag 'shuffle', title: t('text.shuffle_mode') %></span>
<span data-player-target='modeButton'><%= icon_tag 'repeat', title: t('label.repeat_mode') %></span>
<span data-player-target='modeButton'><%= icon_tag 'repeat-one', title: t('label.single_mode') %></span>
<span data-player-target='modeButton'><%= icon_tag 'shuffle', title: t('label.shuffle_mode') %></span>
</div>
<div>
<span class='u-text-color-primary u-cursor-pointer' data-action='click->player#previous' data-test-id='player_previous_button'>
<%= icon_tag 'rewind', size: 'large', title: t('text.previous_song') %>
<%= icon_tag 'rewind', size: 'large', title: t('label.previous_song') %>
</span>
<span class='u-mx-medium u-text-color-primary u-cursor-pointer' data-action='click->player#play' data-player-target='playButton' data-test-id='player_play_button'>
<%= icon_tag 'play', size: 'large', title: t('text.play_song') %>
<%= icon_tag 'play', size: 'large', title: t('label.play_song') %>
</span>
<span class='u-mx-medium u-text-color-primary u-cursor-pointer u-display-none' data-action='click->player#pause' data-player-target='pauseButton' data-test-id='player_pause_button'>
<%= icon_tag 'pause', size: 'large', title: t('text.pause_song') %>
<%= icon_tag 'pause', size: 'large', title: t('label.pause_song') %>
</span>
<span class='u-text-color-primary u-cursor-pointer' data-action='click->player#next' data-test-id='player_next_button'>
<%= icon_tag 'fast-forward', size: 'large', title: t('text.next_song') %>
<%= icon_tag 'fast-forward', size: 'large', title: t('label.next_song') %>
</span>
</div>
<div data-action='turbo:submit-end->player#toggleFavorite' data-test-id='player_favorite_button'>
<%= button_to favorite_playlist_songs_path, form_class: 'u-visibility-hidden', form: { 'data-player-target' => 'favoriteButton' } do %>
<%= icon_tag 'heart', title: t('text.toggle_favorite') %>
<%= icon_tag 'heart', title: t('label.toggle_favorite') %>
<% end %>
<%= button_to favorite_playlist_songs_path, method: :delete, form_class: 'u-display-none', form: { 'data-player-target' => 'unFavoriteButton' }, class: 'u-text-color-red' do %>
<%= icon_tag 'heart', title: t('text.toggle_favorite') %>
<%= icon_tag 'heart', title: t('label.toggle_favorite') %>
<% end %>
</div>
</div>
<div class='u-py-tiny u-bg-primary u-text-align-center u-display-none u-display-block@extra-small' data-action='click->player#collapse'>
<%= icon_tag 'expand-more', size: 'large', title: t('text.collapse_player') %>
<%= icon_tag 'expand-more', size: 'large', title: t('label.collapse_player') %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/songs/_song.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div role='cell' class='u-display-none@small'><%= format_duration(song.duration) %></div>
<div role='cell'>
<%= link_to dialog_playlists_path(song_id: song.id), data: { test_id: 'song_add_playlist', turbo_frame: 'turbo-dialog' } do %>
<%= icon_tag 'playlist-add', size: 'small', title: t('text.add_to_playlist') %>
<%= icon_tag 'playlist-add', size: 'small', title: t('label.add_to_playlist') %>
<% end %>
</div>
</div>
4 changes: 2 additions & 2 deletions app/views/users/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<% page_title_tag t('text.update_profile') %>
<% page_title_tag t('label.update_profile') %>

<% cache @user do %>
<div class='o-container o-container--extra-narrow'>
<h2 class='u-mb-0'><%= t('text.update_profile') %></h2>
<h2 class='u-mb-0'><%= t('label.update_profile') %></h2>
<hr />
<%= render partial: 'users/form', locals: { user: @user } %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/users/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<% page_title_tag t('text.manage_users') %>
<% page_title_tag t('label.manage_users') %>

<% cache @users do %>
<div class='o-container o-container--extra-narrow'>
<div class='o-flex o-flex--justify-between o-flex--align-center'>
<h2 class='u-mb-0'><%= t('label.users') %></h2>
<%= link_to t('text.add_user'), new_user_path, class: 'c-button c-button--primary' %>
<%= link_to t('label.add_user'), new_user_path, class: 'c-button c-button--primary' %>
</div>
<hr />
<div class='u-position-relative'>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class='o-container o-container--extra-narrow'>
<h2 class='u-mb-0'><%= t('text.create_user') %></h2>
<h2 class='u-mb-0'><%= t('label.create_user') %></h2>
<hr />
<%= render partial: 'users/form', locals: { user: @user } %>
</div>
2 changes: 1 addition & 1 deletion app/views/users/settings/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2><%= t('text.personal') %></h2>
<h2><%= t('label.personal') %></h2>
<%= form_with model: user, url: user_setting_path(user), method: :put, class: 'c-form', data: { controller: 'theme', action: 'turbo:submit-end->theme#update' } do |form| %>
<div class='c-form__field'>
<%= form.label :theme %>
Expand Down
29 changes: 14 additions & 15 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,6 @@ en:
add: 'Add'
create_playlist: 'Create Playlist'
edit_playlist: 'Edit Playlist'
error:
login: 'Wrong email or password'
forbidden: "Sorry, you do not have permission to visit that"
not_found: "The page you were looking for doesn't exist"
unprocessable_entity: 'The change you wanted was rejected'
internal_server_error: "We're sorry, but something went wrong"
already_in_playlist: "Add to playlist failed, song is already in playlist"
success:
delete: 'Deleted successfully'
create: 'Created successfully'
update: 'Updated successfully'
add_to_playlist: 'Added to playlist successfully'
delete_from_playlist: 'Deleted from playlist successfully'
text:
no_items: 'No items'
add_to_playlist: 'Add to playlist'
update_profile: 'Update profile'
Expand All @@ -91,7 +77,6 @@ en:
various_artists: 'Various Artists'
unknown_artist: 'Unknown Artist'
unknown_album: 'Unknown Album'
go_back: 'Go back'
repeat_mode: 'Repeat mode'
single_mode: 'Single mode'
shuffle_mode: 'Shuffle mode'
Expand All @@ -108,6 +93,20 @@ en:
edit_artist: 'Edit Artist'
album_cover: 'Album cover'
artist_cover: 'Artist cover'
error:
login: 'Wrong email or password'
forbidden: "Sorry, you do not have permission to visit that"
not_found: "The page you were looking for doesn't exist"
unprocessable_entity: 'The change you wanted was rejected'
internal_server_error: "We're sorry, but something went wrong"
already_in_playlist: "Add to playlist failed, song is already in playlist"
success:
delete: 'Deleted successfully'
create: 'Created successfully'
update: 'Updated successfully'
add_to_playlist: 'Added to playlist successfully'
delete_from_playlist: 'Deleted from playlist successfully'
text:
search_results: "Search results for \"%{query}\""
no_search_results: "No search results for \"%{query}\""
transcoding: "Black candy will transcode formats that are not supported by the browser by default."
Expand Down