Compare commits

...

34 Commits

Author SHA1 Message Date
Daniel O'Connor
7667711d8a Merge branch 'dev' into issue/2745-translations 2025-10-09 23:00:22 +10:30
Daniel O'Connor
e6563d0aab Merge branch 'dev' into issue/2745-translations 2023-03-13 13:52:15 +10:30
Daniel O'Connor
177ca58301 Drop pointless translations 2022-12-10 16:27:25 +10:30
Daniel O'Connor
ca9241685f Update app/views/layouts/_menu.haml 2022-12-10 15:20:31 +10:30
Daniel O'Connor
8934e30603 Remove japanese local, as it is largely untranslated 2022-12-10 14:55:10 +10:30
Daniel O'Connor
32268e3c1e Merge branch 'dev' into issue/2745-translations 2022-12-10 14:49:56 +10:30
Daniel O'Connor
fbd840686d Remove model singular forms, we don't use them 2022-12-10 14:48:06 +10:30
Daniel O'Connor
497f14c1c0 Remove unused keys 2022-12-10 14:40:15 +10:30
Daniel O'Connor
051bfd5565 Remove unused keys 2022-12-10 14:39:17 +10:30
Daniel O'Connor
2853f7232e Remove unused 2022-12-10 14:34:59 +10:30
Daniel O'Connor
60a9d54655 Remove unused 2022-12-10 14:33:33 +10:30
Daniel O'Connor
7598f84cea Remove unused 2022-12-10 14:33:19 +10:30
Daniel O'Connor
a839d68e85 Remove more unused 2022-12-10 14:31:10 +10:30
Daniel O'Connor
ef427a7971 Remove more unused 2022-12-10 14:27:11 +10:30
Daniel O'Connor
9265cad769 Remove more unused translations 2022-12-10 14:22:00 +10:30
Daniel O'Connor
d0185c47fd Remove dead translations 2022-12-10 14:19:00 +10:30
Daniel O'Connor
fa15889d08 Disable normalisation test for now 2022-12-10 14:17:07 +10:30
Daniel O'Connor
1e30aa7db5 Remove old keys 2022-12-10 14:15:08 +10:30
Daniel O'Connor
8512a19bb9 Remove unused keys 2022-12-10 14:12:45 +10:30
Daniel O'Connor
54169fe9ac Adjust translates 2022-12-10 14:01:13 +10:30
Daniel O'Connor
03c65ad187 Codefactor 2022-12-10 10:16:10 +10:30
Daniel O'Connor
70726e7e52 Fix translations 2022-12-10 10:13:52 +10:30
Daniel O'Connor
a14cc807ae Add rails-i18n 2022-12-10 10:10:37 +10:30
Daniel O'Connor
6719024c70 Update en.yml 2022-12-10 10:05:49 +10:30
Daniel O'Connor
6e36525a62 Update config/locales/en.yml 2022-12-10 10:03:31 +10:30
Daniel O'Connor
d1b25ef809 Update config/locales/en.yml 2022-12-10 10:03:17 +10:30
Daniel O'Connor
974a1019f7 Update en.yml 2022-12-10 10:01:56 +10:30
codefactor-io
5370dc9901 [CodeFactor] Apply fixes 2022-12-09 23:27:55 +00:00
Daniel O'Connor
9f470817d7 Add missing translations, auto generated. May want to duplicate the core models 2022-12-10 09:55:44 +10:30
Daniel O'Connor
9250a179f7 Fix buttons 2022-12-10 09:53:57 +10:30
Daniel O'Connor
eec7bac77a Fix button translations 2022-12-10 09:52:24 +10:30
Daniel O'Connor
e325d7a20e Skip images. Later, may want to add js checking for any i18n usage there 2022-12-10 09:48:30 +10:30
Daniel O'Connor
c51dd5097c Translations 2022-12-10 09:45:59 +10:30
Daniel O'Connor
38023746a3 Add spec for detecting missed translations 2022-12-10 09:39:48 +10:30
12 changed files with 94 additions and 184 deletions

View File

@@ -125,6 +125,7 @@ gem 'mailboxer', '>= 0.15.1'
gem 'faraday'
gem 'rack-cors'
gem 'rails-i18n'
gem 'icalendar'

View File

@@ -816,6 +816,7 @@ DEPENDENCIES
rails (~> 7.2.0)
rails-assets-leaflet.markercluster!
rails-controller-testing
rails-i18n
rails_12factor
rake (>= 10.0.0)
recaptcha

View File

@@ -17,7 +17,7 @@
%li= link_to "Roles", admin_roles_path, class: 'nav-link'
%li= link_to "Forums", forums_path, class: 'nav-link'
%li= link_to "CMS", comfy_admin_cms_path, class: 'nav-link'
%li= link_to t('.garden_types'), garden_types_path, class: 'nav-link'
%li= link_to t('layouts.header.garden_types'), garden_types_path, class: 'nav-link'
.col-md-4
.card

View File

@@ -23,7 +23,7 @@
- if can? :edit, role
= link_to edit_admin_role_path(role), class: 'btn btn-default btn-xs' do
= edit_icon
= t('.edit')
= t('buttons.edit')
- if can?(:destroy, role) && ! role.members.any?
= link_to admin_role_path(role), method: :delete, data: { confirm: t(:are_you_sure?) }, class: 'btn btn-default btn-xs text-danger' do
= delete_icon

View File

@@ -10,11 +10,11 @@
- if can? :edit, an
= link_to edit_alternate_name_path(an), class: 'dropdown-item' do
= edit_icon
= t('.edit')
= t('buttons.edit')
- if can? :destroy, an
= link_to an, method: :delete, data: { confirm: 'Are you sure?' }, class: 'dropdown-item' do
= delete_icon
= t('.delete')
= t('buttons.delete')
- else
.badge= "#{an.name} (#{an.language})"

View File

@@ -10,11 +10,11 @@
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "planting-actions-button"}
= link_to edit_scientific_name_path(sn), class: 'dropdown-item' do
= edit_icon
= t('.edit')
= t('buttons.edit')
.dropdown-divider
= link_to sn, method: :delete, data: { confirm: 'Are you sure?' }, class: 'dropdown-item text-danger' do
= delete_icon
= t('.delete')
= t('buttons.delete')
- else
- if sn.gbif_key
= link_to sn.name, "https://www.gbif.org/species/#{sn.gbif_key}",

View File

@@ -8,7 +8,7 @@
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "crop-actions-button"}
= link_to edit_crop_path(crop), class: 'dropdown-item' do
= edit_icon
= t('.edit')
= t('buttons.edit')
= link_to crop_gbif_path(crop), method: :post, class: 'dropdown-item' do
= icon 'far', 'update'

View File

@@ -35,25 +35,25 @@
= t('.crops')
.dropdown-menu
= link_to crops_path, class: 'dropdown-item' do
= t('.browse_crops')
= t('layouts.header.browse_crops')
= link_to seeds_path, class: 'dropdown-item' do
= seed_icon
= t('.seeds')
= t('layouts.header.seeds')
= link_to plantings_path, class: 'dropdown-item' do
= planting_icon
= t('.plantings')
= t('layouts.header.plantings')
= link_to harvests_path, class: 'dropdown-item' do
= harvest_icon
= t('.harvests')
= t('layouts.header.harvests')
%li.nav-item.dropdown
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}
%span
= t('.community')
.dropdown-menu{"aria-labelledby" => "navbarDropdown"}
= link_to t('.community_map'), places_path, class: 'dropdown-item'
= link_to t('.browse_members'), members_path, class: 'dropdown-item'
= link_to t('.posts'), posts_path, class: 'dropdown-item'
= link_to t('.forums'), forums_path, class: 'dropdown-item'
= link_to t('layouts.header.community_map'), places_path, class: 'dropdown-item'
= link_to t('layouts.header.browse_members'), members_path, class: 'dropdown-item'
= link_to Post.model_name.human(count: 2).titleize, posts_path, class: 'dropdown-item'
= link_to t('layouts.header.forums'), forums_path, class: 'dropdown-item'
- if member_signed_in?
- if current_member.role?(:crop_wrangler) || current_member.role?(:admin)
@@ -63,9 +63,9 @@
= t('.admin')
.dropdown-menu{"aria-labelledby" => "navbarDropdown"}
- if current_member.role?(:crop_wrangler)
= link_to t('.crop_wrangling'), wrangle_crops_path, class: 'dropdown-item'
= link_to t('layouts.header.crop_wrangling'), wrangle_crops_path, class: 'dropdown-item'
- if current_member.role?(:admin)
= link_to t('.admin'), admin_path, class: 'dropdown-item'
= link_to t('layouts.header.admin'), admin_path, class: 'dropdown-item'
%li.nav-item.dropdown
%a.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", href: "#", role: "button"}
@@ -79,23 +79,23 @@
= link_to member_activities_path(current_member), class: 'dropdown-item' do
= t('.activities')
= link_to member_gardens_path(current_member), class: 'dropdown-item' do
= t('.gardens')
= Garden.model_name.human(count: 2).titleize
= link_to member_plantings_path(current_member), class: 'dropdown-item' do
= t('.plantings')
= Planting.model_name.human(count: 2).titleize
= link_to member_harvests_path(current_member), class: 'dropdown-item' do
= t('.harvest')
= Harvest.model_name.human(count: 2).titleize
= link_to member_seeds_path(current_member), class: 'dropdown-item' do
= t('.seeds')
= link_to t('.posts'), member_posts_path(current_member), class: 'dropdown-item'
= Seed.model_name.human(count: 2).titleize
= link_to Post.model_name.human(count: 2).titleize, member_posts_path(current_member), class: 'dropdown-item'
- if current_member.unread_count.positive?
.dropdown-divider
%strong
= link_to(conversations_path, class: 'dropdown-item') do
= t('.inbox')
= t('layouts.header.inbox')
%span.badge.badge-info= current_member.unread_count
- else
= link_to t('.inbox'), conversations_path, class: 'dropdown-item'
= link_to t('layouts.header.inbox'), conversations_path, class: 'dropdown-item'
.dropdown-divider
= link_to t('.sign_out'), destroy_member_session_path, method: :delete, class: 'dropdown-item'

View File

@@ -47,7 +47,8 @@ search:
## Paths to search in, passed to File.find
paths:
- app/
- app/views/
- app/controllers/
## Root for resolving relative keys (default)
# relative_roots:

View File

@@ -1,75 +1,7 @@
---
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# The following keys must be escaped otherwise they will not be retrieved by
# the default I18n backend:
#
# true, false, on, off, yes, no
#
# Instead, surround them with single quotes.
#
# en:
# 'true': 'foo'
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en:
activerecord:
models:
comment:
one: comment
other: comments
crop:
one: crop
other: crops
follow:
one: follow
other: follows
garden:
one: garden
other: gardens
harvest:
one: harvest
other: harvests
member:
one: member
other: members
photo:
one: photo
other: photos
planting:
one: planting
other: plantings
post:
one: post
other: posts
seed:
one: seed
other: seeds
application_helper:
title:
title:
default: Default
are_you_sure: Are you sure?
buttons:
add: Add
add_photo: Add photo
add_seed_to_stash: Add %{crop_name} seeds to stash
copy: Copy
@@ -98,17 +30,28 @@ en:
unlike: Remove like
total_likes: Total likes
crops:
search: Search crops
index:
subtitle: "%{crops_size} total"
title: Browse Crops
requested:
link: You have %{number_crops} crops awaiting approval
subtitle: Pending approval
title: Requested crops
edit_crop: Edit crop
forms:
optional: "(Optional)"
date:
abbr_month_names:
- Jan
- Feb
- Mar
- Apr
- May
- Jun
- Jul
- Aug
- Sep
- Oct
- Nov
- Dec
errors:
messages:
not_saved: Not saved
forums:
index:
title: Forums
@@ -117,26 +60,12 @@ en:
deleted: Garden was successfully deleted.
form:
location_helper: If you have a location set in your profile, it will be used when you create a new garden.
location: "%{owner}'s %{garden}"
overview:
gardensactions: gardens/actions
gardensphoto: gardens/photo
no_plantings: no plantings
plantingsthumbnail: plantings/thumbnail
updated: Garden was successfully updated.
confirm_delete: All plantings associated with this garden will also be deleted. Are you sure?
confirm_deactivate: All plantings associated with this garden will be marked as finished. Are you sure?
created_prompt_html: "Garden was successfully created. Would you like to <a href=\"%{link}\">plan to weed this garden bed in two weeks</a>?"
harvests:
created: Harvest was successfully created.
harvest_something: Harvest something
index:
title:
crop_harvests: Everyone's %{crop} harvests
default: Everyone's harvests
owner_harvests: "%{owner}'s harvests"
planting_harvests: Harvests from %{planting}
updated: Harvest was successfully updated.
home:
blurb:
already_html: Or %{sign_in} if you already have an account
@@ -150,23 +79,15 @@ en:
view_all: View all activities
crops:
our_crops: Some of our crops
recently_added: Recently added crops
recently_planted: Recently Planted
view_all: View all crops
discuss:
discussion: Discussion
forums: Forums
view_all: View all posts
harvests:
recently_harvested: Recently Harvested
view_all: View all harvests
index:
add_seeds: Add seeds
edit_profile: Edit profile
harvest: Harvest
plant: Plant
post: Post
recently_added: Recently Added
welcome: Welcome to %{site_name}, %{member_name}
harvests:
view_all: View all harvests
members:
title: Some of our members
view_all: View all members
@@ -199,14 +120,7 @@ en:
recently_planted: Recently Planted
view_all: View all plantings
seeds:
crop: Crop
description: Description
details: Details
from: From location
owner: Owner
title: Seeds available to trade
trade_to: Will trade to
unspecified: unspecified
view_all: View all seeds
stats:
member_linktext: "%{count} members"
@@ -220,13 +134,12 @@ en:
pwa_ios_title: For iOS (iPhone/iPad)
pwa_title: Want to install Growstuff on your phone?
label:
days_until_harvest: "%{number} days"
weeks_until_harvest: "%{number} weeks until harvest"
days_until_finished: "%{number} days"
weeks_until_finished: "%{number} weeks"
harvesting_now: harvesting now
data: 'The data on this page is available in the following formats:'
harvesting_now: harvesting now
weeks_until_harvest: "%{number} weeks until harvest"
layouts:
application:
skip: Skip
header:
activities: Activities
account: Account
@@ -235,33 +148,19 @@ en:
browse_members: Browse Members
community: Community
community_map: Community Map
garden_type: Garden Type
garden_types: Garden Types
crop_wrangling: Crop Wrangling
crops: Crops
current_memberlogin_name: "%{current_memberlogin_name}"
forums: Forums
gardens: Gardens
harvest: Harvest
garden_types: Garden Types
harvests: Harvests
record: Record
inbox: Inbox
inbox_unread: Inbox (%{unread_count})
plantings: Plantings
posts: Posts
profile: Profile/Timeline
seeds: Seeds
skip: Skip navigation menu
support_growstuff: Support Growstuff
toggle_navigation: Toggle Navigation
your_stuff: Your Stuff
menu:
sign_in: Sign in
sign_out: Sign out
sign_up: Sign up
links:
my_gardens: My gardens
members:
edit_profile: Edit profile
index:
@@ -305,13 +204,8 @@ en:
no longer possible.
plantings:
badges:
days_until_finished: days until finished
days_until_harvest: days until harvest
harvesting_now: harvesting now
late_finishing: late finishing
sharedbuttonsfinish_planting: shared/buttons/finish_planting
super_late: super late
plant_something: Plant something
form:
finish_helper: >
A planting is finished when you've harvested all of the crop, or it dies, or it's otherwise
@@ -328,35 +222,18 @@ en:
progress:
progress_0_not_planted_yet: 'Progress: 0% - not planted yet'
posts:
write_blog_post: Write blog post
index:
title:
author_posts: "%{author} posts"
default: Everyone's posts
write_blog_post: Write blog post
seeds:
form:
trade_help: >
Are you interested in trading or swapping seeds with other %{site_name} members? If you list
your seeds as available for trade, other members can contact you to request seeds. You can
list any conditions or other information in the description, above.
finish_helper: >
Seeds are finished when you've planted them all, or you've traded them all away.
index:
title:
crop_seeds: Everyone's %{crop} seeds
default: Everyone's seeds
owner_seeds: "%{owner} seeds"
trade_help: >
Are you interested in trading or swapping seeds with other %{site_name} members?
If you list your seeds as available for trade, other members can contact you to request seeds.
You can list any conditions or other information in the description, above.
save_seeds: Save seeds
string: "%{crop} seeds belonging to %{owner}"
unauthorized:
create:
all: Please sign in or sign up to create a %{subject}.
notification: Please sign in to send a message.
planting: Please sign in or sign up to plant something.
post: Please sign in or sign up to post.
seed: Please sign in or sign up to add seeds.
garden_type: Not authorized. Only admins can create garden types.
manage:
all: Not authorized to %{action} %{subject}.
read:
notification: You must be signed in to view notifications.
view: View

View File

@@ -1,5 +0,0 @@
---
ja:
home:
blurb:
intro: "%{site_name}はガーデナーのコミュニティです。"

35
spec/views/i18n_spec.rb Normal file
View File

@@ -0,0 +1,35 @@
# frozen_string_literal: true
require 'rails_helper'
require 'i18n/tasks'
RSpec.describe I18n do
let(:i18n) { I18n::Tasks::BaseTask.new }
let(:missing_keys) { i18n.missing_keys }
let(:unused_keys) { i18n.unused_keys }
let(:inconsistent_interpolations) { i18n.inconsistent_interpolations }
it 'does not have missing keys' do
expect(missing_keys).to be_empty,
"Missing #{missing_keys.leaves.count} i18n keys, run `i18n-tasks missing' to show them"
end
it 'does not have unused keys' do
expect(unused_keys).to be_empty,
"#{unused_keys.leaves.count} unused i18n keys, run `i18n-tasks unused' to show them"
end
xit 'files are normalized' do
non_normalized = i18n.non_normalized_paths
error_message = "The following files need to be normalized:\n" \
"#{non_normalized.map { |path| " #{path}" }.join("\n")}\n" \
"Please run `i18n-tasks normalize' to fix"
expect(non_normalized).to be_empty, error_message
end
it 'does not have inconsistent interpolations' do
error_message = "#{inconsistent_interpolations.leaves.count} i18n keys have inconsistent interpolations.\n" \
"Run `i18n-tasks check-consistent-interpolations' to show them"
expect(inconsistent_interpolations).to be_empty, error_message
end
end