Remove i18n-inflector-rails dependency
There are no new releases anymore and the current version isn't compatible with ruby 3.x. As this feature wasn't really used a lot (Icelandic didn't even setup inflections properly), it's probably not worth fighting for it, so lets just drop it. Related to #8369
This commit is contained in:
parent
87f17fe907
commit
6f802417c6
10 changed files with 9 additions and 189 deletions
1
Gemfile
1
Gemfile
|
|
@ -97,7 +97,6 @@ gem "js-routes", "2.2.4"
|
|||
# Localization
|
||||
|
||||
gem "http_accept_language", "2.1.1"
|
||||
gem "i18n-inflector-rails", "1.0.7"
|
||||
gem "rails-i18n", "6.0.0"
|
||||
|
||||
# Map
|
||||
|
|
|
|||
|
|
@ -362,12 +362,6 @@ GEM
|
|||
httpclient (2.8.3)
|
||||
i18n (1.12.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n-inflector (2.6.7)
|
||||
i18n (>= 0.4.1)
|
||||
i18n-inflector-rails (1.0.7)
|
||||
actionpack (>= 3.0.0)
|
||||
i18n-inflector (~> 2.6)
|
||||
railties (>= 3.0.0)
|
||||
idn-ruby (0.1.0)
|
||||
image_processing (1.12.2)
|
||||
mini_magick (>= 4.9.5, < 5)
|
||||
|
|
@ -810,7 +804,6 @@ DEPENDENCIES
|
|||
hamlit (= 2.16.0)
|
||||
handlebars_assets (= 0.23.9)
|
||||
http_accept_language (= 2.1.1)
|
||||
i18n-inflector-rails (= 1.0.7)
|
||||
jasmine (= 3.10.0)
|
||||
jasmine-jquery-rails (= 2.0.3)
|
||||
jquery-rails (= 4.5.0)
|
||||
|
|
|
|||
|
|
@ -21,15 +21,12 @@ class ApplicationController < ActionController::Base
|
|||
before_action :ensure_http_referer_is_set
|
||||
before_action :set_locale
|
||||
before_action :set_diaspora_header
|
||||
before_action :set_grammatical_gender
|
||||
before_action :mobile_switch
|
||||
before_action :gon_set_current_user
|
||||
before_action :gon_set_appconfig
|
||||
before_action :gon_set_preloads
|
||||
before_action :configure_permitted_parameters, if: :devise_controller?
|
||||
|
||||
inflection_method grammatical_gender: :gender
|
||||
|
||||
helper_method :all_aspects,
|
||||
:all_contacts_count,
|
||||
:my_contacts_count,
|
||||
|
|
@ -108,28 +105,6 @@ class ApplicationController < ActionController::Base
|
|||
redirect_to stream_url, notice: "you need to be an admin or moderator to do that"
|
||||
end
|
||||
|
||||
def set_grammatical_gender
|
||||
if (user_signed_in? && I18n.inflector.inflected_locale?)
|
||||
gender = current_user.gender.to_s.tr('!()[]"\'`*=|/\#.,-:', '').downcase
|
||||
unless gender.empty?
|
||||
i_langs = I18n.inflector.inflected_locales(:gender)
|
||||
i_langs.delete I18n.locale
|
||||
i_langs.unshift I18n.locale
|
||||
i_langs.each do |lang|
|
||||
token = I18n.inflector.true_token(gender, :gender, lang)
|
||||
unless token.nil?
|
||||
@grammatical_gender = token
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def grammatical_gender
|
||||
@grammatical_gender || nil
|
||||
end
|
||||
|
||||
# use :mobile view for mobile and :html for everything else
|
||||
# (except if explicitly specified, e.g. :json, :xml)
|
||||
def mobile_switch
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
is:
|
||||
devise:
|
||||
confirmations:
|
||||
confirmed: "Aðgangurinn þinn hefur nú verið staðfestur. Þú ert @{f:innskráð|m:innskráður|innskráð(ur)}."
|
||||
confirmed: "Aðgangurinn þinn hefur nú verið staðfestur. Þú ert innskráð(ur)."
|
||||
new:
|
||||
resend_confirmation: "Endursenda leiðbeiningar um staðfestingu"
|
||||
send_instructions: "Þú munt fá tölvupóst innan fárra mínútna, með leiðbeiningum um hvernig þú staðfestir aðganginn þinn."
|
||||
|
|
@ -23,7 +23,7 @@ is:
|
|||
invitations:
|
||||
invitation_token_invalid: "Okkur þykir það leitt, en þetta er ekki gildur boðslykill."
|
||||
send_instructions: "Boðið þitt hefur verið sent."
|
||||
updated: "Nú er búið að stilla lykilorðið þitt og þú ert hér með @{f:innskráð|m:innskráður|innskráð(ur)}."
|
||||
updated: "Nú er búið að stilla lykilorðið þitt og þú ert hér með innskráð(ur)."
|
||||
mailer:
|
||||
confirmation_instructions:
|
||||
confirm: "Staðfesta aðganginn minn"
|
||||
|
|
@ -89,4 +89,4 @@ is:
|
|||
messages:
|
||||
already_confirmed: "var nú þegar staðfestur"
|
||||
not_found: "fannst ekki"
|
||||
not_locked: "ólæstur"
|
||||
not_locked: "ólæstur"
|
||||
|
|
|
|||
|
|
@ -114,13 +114,11 @@ pl:
|
|||
account_closing_scheduled: "Konto należące do %{name} jest przewidziane do zamknięcia. Zostanie to wykonane w przecigu kilku chwil..."
|
||||
account_locking_scheduled: "Konto użytkownika %{name} oznaczone do zablokowania. Zostanie przetworzone za kilka chwil..."
|
||||
account_unlocking_scheduled: "Konto użytkownika %{name} oznaczone do odblokowania. Zostanie przetworzone za kilka chwil..."
|
||||
add_admin: "%{name} zosta@{m:ł|f:ła|n:ło} mianowa@{m:ny|f:na|n:ne} administratorem."
|
||||
add_invites: "Dodaj zaproszenia"
|
||||
are_you_sure: "Czy na pewno chcesz zamknąć to konto?"
|
||||
are_you_sure_lock_account: "Na pewno zablokować to konto?"
|
||||
are_you_sure_unlock_account: "Na pewno odblokować to konto?"
|
||||
close_account: "Zamknij konto"
|
||||
delete_admin: "%{name} został@{f:a|n:o} usunię@{m:ty|f:ta|n:te} z listy administratorów."
|
||||
does_not_exist: "Użytkownik nie istnieje!"
|
||||
email_to: "Zaproś przez e-mail"
|
||||
invite: "Zaproś"
|
||||
|
|
@ -224,7 +222,7 @@ pl:
|
|||
edit:
|
||||
aspect_list_is_not_visible: "Kontakty z tego aspektu nie widzą się nawzajem."
|
||||
aspect_list_is_visible: "Kontakty z tego aspektu mogą zobaczyć się nawzajem."
|
||||
confirm_remove_aspect: "@{m,f:Jesteś|n:Czy na}{ pew}{m:ien|f:na|n:no}{m,f:, że } chcesz usunąć ten aspekt?"
|
||||
confirm_remove_aspect: "Czy na pewno chcesz usunąć ten aspekt?"
|
||||
rename: "Zmień nazwę"
|
||||
update: "Aktualizuj"
|
||||
updating: "Aktualizowanie"
|
||||
|
|
@ -236,7 +234,7 @@ pl:
|
|||
contact_podmin: "Skontaktuj się z administratorem swojego poda!"
|
||||
do_you: "Czy:"
|
||||
feature_suggestion: "... masz propozycję (%{link})?"
|
||||
find_a_bug: "... znal@{m:azłeś|f:azłaś|n:eziono} %{link}?"
|
||||
find_a_bug: "... znaleziono %{link}?"
|
||||
have_a_question: "... masz %{link}?"
|
||||
here_to_help: "Społeczność diaspory* jest tutaj!"
|
||||
mail_podmin: "Adres e-mail administratora"
|
||||
|
|
@ -951,7 +949,7 @@ pl:
|
|||
create:
|
||||
integrity_error: "Nie udało się przesłać zdjęcia? Czy to na pewno był plik obrazu?"
|
||||
runtime_error: "Nie udało się przesłać zdjęcia. Jesteś pewny, że zapiąłeś pasy bezpieczeństwa?"
|
||||
type_error: "Nie udało się przesłać zdjęcia. Czy na pewno doda@{m:łeś|f:łaś|n:no} obraz?"
|
||||
type_error: "Nie udało się przesłać zdjęcia. Czy na pewno dodano obraz?"
|
||||
destroy:
|
||||
notice: "Usunięto zdjęcie."
|
||||
new_profile_photo:
|
||||
|
|
@ -1321,4 +1319,4 @@ pl:
|
|||
unconfirmed_email_not_changed: "Zmiana adresu e-mail nie powiodła się"
|
||||
will_paginate:
|
||||
next_label: "dalej »"
|
||||
previous_label: "« wstecz"
|
||||
previous_label: "« wstecz"
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
This directory contains the definitions for the [i18n-inflector gem](https://github.com/siefca/i18n-inflector).
|
||||
Also, look up for our wiki on [How to contribute translations](http://wiki.diasporafoundation.org/Contribute_translations) for more information.
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
|
||||
all:
|
||||
i18n:
|
||||
inflections:
|
||||
gender:
|
||||
f: "female"
|
||||
m: "male"
|
||||
n: "neuter"
|
||||
masculine: :@m
|
||||
male: :@m
|
||||
man: :@m
|
||||
boy: :@m
|
||||
b: :@m
|
||||
he: :@m
|
||||
sir: :@m
|
||||
mr: :@m
|
||||
mister: :@m
|
||||
guy: :@m
|
||||
dude: :@m
|
||||
gentleman: :@m
|
||||
mal: :@m
|
||||
female: :@f
|
||||
feminine: :@f
|
||||
girl: :@f
|
||||
g: :@f
|
||||
lady: :@f
|
||||
she: :@f
|
||||
miss: :@f
|
||||
missus: :@f
|
||||
mrs: :@f
|
||||
missis: :@f
|
||||
mistress: :@f
|
||||
ms: :@f
|
||||
neuter: :@n
|
||||
neutral: :@n
|
||||
it: :@n
|
||||
they: :@n
|
||||
impersonal: :@n
|
||||
default: :n
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
|
||||
pl:
|
||||
i18n:
|
||||
inflections:
|
||||
gender:
|
||||
f: "rodzaj żeński"
|
||||
m: "rodzaj męski"
|
||||
n: "rodzaj nijaki"
|
||||
masculine: :@m
|
||||
facet: :@m
|
||||
chłop: :@m
|
||||
chłopak: :@m
|
||||
chłopek: :@m
|
||||
chłopiec: :@m
|
||||
chłopaczek: :@m
|
||||
mąż: :@m
|
||||
prawiczek: :@m
|
||||
prawik: :@m
|
||||
boj: :@m
|
||||
woj: :@m
|
||||
gość: :@m
|
||||
gostek: :@m
|
||||
gościu: :@m
|
||||
samiec: :@m
|
||||
samczyk: :@m
|
||||
kawaler: :@m
|
||||
mężczyzna: :@m
|
||||
męski: :@m
|
||||
pani: :@f
|
||||
kobieta: :@f
|
||||
k: :@f
|
||||
kobietka: :@f
|
||||
dziewczyna: :@f
|
||||
dziewczę: :@f
|
||||
baba: :@f
|
||||
babka: :@f
|
||||
facetka: :@f
|
||||
dziewczynka: :@f
|
||||
dziewica: :@f
|
||||
niewiasta: :@f
|
||||
samica: :@f
|
||||
samiczka: :@f
|
||||
ona: :@f
|
||||
panna: :@f
|
||||
pannica: :@f
|
||||
panienka: :@f
|
||||
żeński: :@f
|
||||
laska: :@f
|
||||
lasencja: :@f
|
||||
żona: :@f
|
||||
dziewoja: :@f
|
||||
neuter: :@n
|
||||
to: :@n
|
||||
ono: :@n
|
||||
dziecko: :@n
|
||||
ktoś: :@n
|
||||
coś: :@n
|
||||
impersonal: :@n
|
||||
nijaki: :@n
|
||||
default: :n
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ pl:
|
|||
hide: "Ukryj komentarze"
|
||||
no_comments: "Póki co nie ma jeszcze żadnych komentarzy."
|
||||
show: "Pokaż wszystkie komentarze"
|
||||
confirm_dialog: "Czy @{m,f:jesteś|n:na}{ pew}{m:ien|f:na|n:no}?"
|
||||
confirm_dialog: "Czy na pewno?"
|
||||
confirm_unload: "Potwierdź, że chcesz opuścić tę stronę. Dane, które wprowadziłeś, nie zostaną zapisane."
|
||||
contacts:
|
||||
add_contact: "Dodaj kontakt"
|
||||
|
|
@ -343,4 +343,4 @@ pl:
|
|||
other: "%d lat"
|
||||
unblock_failed: "Nie udało się odblokować tego użytkownika"
|
||||
viewer:
|
||||
reshared: "Przekazano dalej"
|
||||
reshared: "Przekazano dalej"
|
||||
|
|
|
|||
|
|
@ -124,39 +124,4 @@ describe ApplicationController, :type => :controller do
|
|||
expect(@controller.send(:after_sign_out_path_for, alice)).to eq(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#set_grammatical_gender" do
|
||||
it "is called on page load" do
|
||||
expect(@controller).to receive(:set_grammatical_gender)
|
||||
get :index
|
||||
end
|
||||
|
||||
context "for inflected locales" do
|
||||
before do
|
||||
alice.language = :pl
|
||||
alice.save
|
||||
end
|
||||
|
||||
it "returns nil for an empty gender" do
|
||||
alice.person.profile.gender = ""
|
||||
alice.person.profile.save
|
||||
get :index
|
||||
expect(assigns[:grammatical_gender]).to be_nil
|
||||
end
|
||||
|
||||
it "returns nil for an unrecognized gender" do
|
||||
alice.person.profile.gender = "robot"
|
||||
alice.person.profile.save
|
||||
get :index
|
||||
expect(assigns[:grammatical_gender]).to be_nil
|
||||
end
|
||||
|
||||
it "sets the correct grammatical gender" do
|
||||
alice.person.profile.gender = "ona"
|
||||
alice.person.profile.save
|
||||
get :index
|
||||
expect(assigns[:grammatical_gender]).to eq(:f)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue