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

Update i18n from Crowdin #2998

Merged
merged 566 commits into from
Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
566 commits
Select commit Hold shift + click to select a range
c0f8195
New translations budgets.yml (Russian)
Oct 26, 2018
96b6697
New translations budgets.yml (Russian)
Oct 26, 2018
c82adf7
New translations budgets.yml (Russian)
Oct 26, 2018
f14a873
New translations budgets.yml (Russian)
Oct 26, 2018
a75c369
New translations budgets.yml (Russian)
Oct 26, 2018
540c2a7
New translations budgets.yml (Russian)
Oct 26, 2018
6271adf
New translations budgets.yml (Russian)
Oct 26, 2018
32abeaf
New translations budgets.yml (Russian)
Oct 26, 2018
da018bf
New translations activerecord.yml (Russian)
Oct 26, 2018
48f5e04
New translations activerecord.yml (Russian)
Oct 26, 2018
f2c3608
New translations activerecord.yml (Russian)
Oct 26, 2018
c24afe2
New translations activerecord.yml (Russian)
Oct 26, 2018
2a65e33
New translations activerecord.yml (Russian)
Oct 26, 2018
889d660
New translations budgets.yml (Russian)
Oct 27, 2018
29c6367
New translations budgets.yml (Russian)
Oct 27, 2018
5491517
New translations budgets.yml (Russian)
Oct 27, 2018
023b189
New translations budgets.yml (Russian)
Oct 27, 2018
5ad09b6
New translations activerecord.yml (Russian)
Oct 27, 2018
3d3614e
New translations activerecord.yml (Russian)
Oct 27, 2018
c6cee0d
New translations activerecord.yml (Russian)
Oct 27, 2018
89a549a
New translations activerecord.yml (Russian)
Oct 27, 2018
3099f20
New translations rails.yml (Spanish, Chile)
Oct 27, 2018
afdea00
New translations moderation.yml (Spanish, Chile)
Oct 27, 2018
52988ea
New translations devise.yml (Spanish, Chile)
Oct 27, 2018
638dc1f
New translations pages.yml (Spanish, Chile)
Oct 27, 2018
5941116
New translations activerecord.yml (Spanish, Chile)
Oct 27, 2018
fdd77ce
New translations i18n.yml (Spanish, Chile)
Oct 27, 2018
fd0e2ab
New translations pages.yml (Spanish, Chile)
Oct 27, 2018
02139c8
New translations activerecord.yml (Galician)
Oct 29, 2018
b90c299
New translations rails.yml (Arabic)
Oct 29, 2018
ea63b27
New translations rails.yml (Arabic)
Oct 29, 2018
6b8e4ed
New translations rails.yml (Arabic)
Oct 29, 2018
6c1a3b0
New translations rails.yml (Arabic)
Oct 29, 2018
d00c905
New translations rails.yml (Arabic)
Oct 29, 2018
41c035f
New translations rails.yml (Arabic)
Oct 29, 2018
88990d2
New translations activerecord.yml (Spanish)
Oct 31, 2018
10ec521
New translations activerecord.yml (Spanish)
Oct 31, 2018
de2aa3a
New translations valuation.yml (Spanish)
Oct 31, 2018
f15dfec
New translations legislation.yml (Spanish)
Oct 31, 2018
c80e2d3
New translations budgets.yml (Spanish)
Oct 31, 2018
1ae9cc8
New translations documents.yml (Spanish)
Oct 31, 2018
06f2a47
New translations devise.yml (Spanish)
Oct 31, 2018
acb92f1
New translations devise_views.yml (Spanish)
Oct 31, 2018
5462ca9
New translations responders.yml (Spanish)
Oct 31, 2018
5d0ccdc
New translations rails.yml (Arabic)
Nov 1, 2018
9f65537
New translations rails.yml (Arabic)
Nov 1, 2018
2e79238
New translations moderation.yml (Arabic)
Nov 1, 2018
b1d7e5f
New translations pages.yml (Arabic)
Nov 1, 2018
c5c1a88
New translations pages.yml (Arabic)
Nov 1, 2018
14d456d
New translations admin.yml (Spanish)
Nov 2, 2018
350874c
New translations admin.yml (Spanish)
Nov 2, 2018
03bed03
New translations admin.yml (Spanish)
Nov 2, 2018
f9dc3e8
New translations admin.yml (Spanish)
Nov 2, 2018
041377a
New translations general.yml (Spanish)
Nov 2, 2018
d210315
New translations mailers.yml (Spanish)
Nov 2, 2018
32ff16a
New translations general.yml (Spanish)
Nov 2, 2018
df0c23f
New translations management.yml (Spanish)
Nov 2, 2018
d539c48
New translations i18n.yml (Spanish)
Nov 2, 2018
fa9b667
New translations moderation.yml (Spanish)
Nov 2, 2018
b2b1628
New translations pages.yml (Spanish)
Nov 2, 2018
e94897c
New translations officing.yml (Spanish)
Nov 2, 2018
af63771
New translations seeds.yml (Spanish)
Nov 2, 2018
a811b2a
New translations pages.yml (Spanish)
Nov 2, 2018
9e525af
New translations settings.yml (Spanish)
Nov 2, 2018
ebdf8ff
New translations settings.yml (Spanish)
Nov 2, 2018
4bb3985
New translations settings.yml (German)
Nov 2, 2018
bf26b96
New translations settings.yml (German)
Nov 2, 2018
09ec776
New translations budgets.yml (German)
Nov 2, 2018
df56673
New translations pages.yml (German)
Nov 2, 2018
3a5f95b
New translations pages.yml (German)
Nov 2, 2018
13acab5
New translations settings.yml (German)
Nov 2, 2018
ad13b52
New translations pages.yml (German)
Nov 2, 2018
62140ff
New translations settings.yml (German)
Nov 2, 2018
e54ab28
New translations settings.yml (German)
Nov 2, 2018
0f81408
New translations settings.yml (German)
Nov 2, 2018
3d6d4cf
New translations community.yml (Russian)
Nov 3, 2018
1f8146b
New translations community.yml (Russian)
Nov 3, 2018
cfa7085
New translations community.yml (Russian)
Nov 3, 2018
c27c5a4
New translations documents.yml (Russian)
Nov 3, 2018
ce08ef3
New translations documents.yml (Russian)
Nov 3, 2018
55cb116
New translations images.yml (Russian)
Nov 3, 2018
13a221f
New translations devise.yml (Russian)
Nov 3, 2018
b0676f7
New translations devise.yml (Russian)
Nov 3, 2018
979af8f
New translations devise.yml (Russian)
Nov 3, 2018
1038240
New translations devise.yml (Russian)
Nov 3, 2018
34035d3
New translations rails.yml (Arabic)
Nov 3, 2018
863fd8a
New translations moderation.yml (Arabic)
Nov 3, 2018
34e14a0
New translations devise.yml (Russian)
Nov 5, 2018
fa146bd
New translations community.yml (Russian)
Nov 5, 2018
fc11213
New translations community.yml (Russian)
Nov 5, 2018
3fe5fb7
New translations community.yml (Russian)
Nov 5, 2018
a6e3079
New translations devise.yml (Russian)
Nov 5, 2018
ee644b6
New translations community.yml (Russian)
Nov 5, 2018
2755efc
New translations community.yml (Russian)
Nov 5, 2018
f81b330
New translations documents.yml (Russian)
Nov 5, 2018
b147aba
New translations documents.yml (Russian)
Nov 5, 2018
79f93d1
New translations general.yml (Galician)
Nov 5, 2018
3b1a76c
New translations admin.yml (Galician)
Nov 5, 2018
8e2b356
New translations i18n.yml (Arabic)
Nov 5, 2018
894023a
New translations i18n.yml (Asturian)
Nov 5, 2018
d871cf8
New translations i18n.yml (Catalan)
Nov 5, 2018
157ba6c
New translations i18n.yml (English, United Kingdom)
Nov 5, 2018
99a62d2
New translations i18n.yml (English, United States)
Nov 5, 2018
589baa9
New translations i18n.yml (Spanish, Argentina)
Nov 5, 2018
6286f73
New translations i18n.yml (Spanish, Bolivia)
Nov 5, 2018
6bae399
New translations i18n.yml (Spanish, Chile)
Nov 5, 2018
a39c856
New translations i18n.yml (Spanish, Colombia)
Nov 5, 2018
e28044e
New translations i18n.yml (Spanish, Costa Rica)
Nov 5, 2018
bfb4131
New translations i18n.yml (Spanish, Dominican Republic)
Nov 5, 2018
d3b3d13
New translations i18n.yml (Spanish, Ecuador)
Nov 5, 2018
642cbfe
New translations i18n.yml (Spanish, Guatemala)
Nov 5, 2018
fc6e2b5
New translations i18n.yml (Spanish, Honduras)
Nov 5, 2018
0402ce1
New translations i18n.yml (Basque)
Nov 5, 2018
b7624e5
New translations i18n.yml (Spanish, El Salvador)
Nov 5, 2018
7397967
New translations i18n.yml (Spanish, Venezuela)
Nov 5, 2018
3f88edb
New translations i18n.yml (Spanish, Uruguay)
Nov 5, 2018
45b8174
New translations i18n.yml (Spanish, Puerto Rico)
Nov 5, 2018
39e20a2
New translations i18n.yml (Spanish, Peru)
Nov 5, 2018
f0bb964
New translations i18n.yml (Spanish, Paraguay)
Nov 5, 2018
2705007
New translations i18n.yml (Spanish, Panama)
Nov 5, 2018
8cc0616
New translations i18n.yml (Spanish, Nicaragua)
Nov 5, 2018
1b3f428
New translations i18n.yml (Spanish, Mexico)
Nov 5, 2018
95a37c5
New translations i18n.yml (Somali)
Nov 5, 2018
91e8905
New translations i18n.yml (Dutch)
Nov 5, 2018
8e288c6
New translations i18n.yml (Slovenian)
Nov 5, 2018
36e6245
New translations i18n.yml (Russian)
Nov 5, 2018
2dcbeb5
New translations i18n.yml (Portuguese, Brazilian)
Nov 5, 2018
5e72d65
New translations i18n.yml (Papiamento)
Nov 5, 2018
3786568
New translations i18n.yml (Italian)
Nov 5, 2018
45cd259
New translations i18n.yml (Indonesian)
Nov 5, 2018
063b006
New translations i18n.yml (Hebrew)
Nov 5, 2018
1c0ab64
New translations i18n.yml (Galician)
Nov 5, 2018
da2fff8
New translations i18n.yml (Turkish)
Nov 5, 2018
58c2862
New translations i18n.yml (Chinese Simplified)
Nov 5, 2018
9b80b0e
New translations i18n.yml (Valencian)
Nov 5, 2018
28d9e9e
New translations i18n.yml (Chinese Traditional)
Nov 5, 2018
ed8aa44
New translations rails.yml (French)
Nov 5, 2018
7cb69ff
New translations rails.yml (Persian)
Nov 5, 2018
ec03272
New translations rails.yml (Spanish, Venezuela)
Nov 5, 2018
edea5c1
New translations rails.yml (Albanian)
Nov 5, 2018
23a5ecd
New translations rails.yml (Dutch)
Nov 5, 2018
0b7730f
New translations rails.yml (Galician)
Nov 5, 2018
e71d6dd
New translations rails.yml (Indonesian)
Nov 5, 2018
192d654
New translations rails.yml (Italian)
Nov 5, 2018
a4f8755
New translations rails.yml (Polish)
Nov 5, 2018
6c33f17
New translations rails.yml (Portuguese, Brazilian)
Nov 5, 2018
6079c1f
New translations i18n.yml (German)
Nov 5, 2018
1db9022
New translations i18n.yml (Persian)
Nov 5, 2018
86ebd64
New translations rails.yml (Turkish)
Nov 5, 2018
8e6922d
New translations devise.yml (Spanish, El Salvador)
Nov 5, 2018
90fec25
New translations general.yml (Spanish, El Salvador)
Nov 5, 2018
93c5352
New translations mailers.yml (Spanish, El Salvador)
Nov 5, 2018
3bd19b2
New translations general.yml (Spanish, El Salvador)
Nov 5, 2018
c46ee11
Fix flaky spec for translations
voodoorai2000 Oct 10, 2018
b49b20a
Fix locale folder names
voodoorai2000 Oct 9, 2018
e357ff2
Change spelling for constant to TITLE_LENGTH_RANGE, instead of TITLE_…
kreopelle Oct 11, 2018
82187a9
Skip spec before doing any requests
javierm Aug 9, 2018
5117f3e
Add all language names
voodoorai2000 Oct 9, 2018
df32a54
Add all available locales
voodoorai2000 Oct 9, 2018
9fcd259
Add fallback i18n locales
voodoorai2000 Oct 9, 2018
56e85ff
Remove duplicate language names
voodoorai2000 Oct 16, 2018
2c34a8b
Remove fallback rules for locales not yet added
voodoorai2000 Oct 16, 2018
bc0479f
Fix pluralization spec when using different default locale
voodoorai2000 Oct 10, 2018
c80e436
Removes guide feature
decabeza Sep 28, 2018
5e95339
Fix flaky legislation question spec
javierm Oct 17, 2018
55a32d8
Bring back CKEditor images button
javierm Oct 17, 2018
8cd6253
Ease customization in processes controller
javierm Oct 9, 2018
8893118
Updates is-active class for view mode
decabeza Oct 18, 2018
d5aa4f7
Fixes color of datepicker calendar
decabeza Oct 18, 2018
22d8a26
Removes unnecessary styles for admin budgets groups
decabeza Oct 18, 2018
ebca4bc
Removes styles to fix logo size on devise views
decabeza Oct 18, 2018
c30c94f
Removes condition to allow images and data equalizer on proposals
decabeza Oct 18, 2018
68b83f3
Removes unnecessary style to orbit slide
decabeza Oct 18, 2018
009cea2
Validate translations in banners
javierm Oct 7, 2018
1874480
Simplify passing the locale to translatable fields
javierm Oct 7, 2018
6fc3389
Keep invalid translation params through requests
javierm Oct 8, 2018
a8f8a7b
Don't disable new invalid translations
javierm Oct 8, 2018
5e6dfe6
Disable removed translations
javierm Oct 8, 2018
d40cd39
Update admin notifications translatable fields
javierm Oct 8, 2018
d5bd481
Update milestones translatable fields
javierm Oct 8, 2018
968a5b1
Update legislation drafts translatable fields
javierm Oct 9, 2018
9c5a7c5
Update legislation process translatable fields
javierm Oct 9, 2018
7cd06bd
Update legislation questions translatable fields
javierm Oct 10, 2018
601fe66
Fix question options translations not being saved
javierm Oct 10, 2018
6478bb7
Update polls translatable fields
javierm Oct 10, 2018
292609e
Update poll questions translatable fields
javierm Oct 10, 2018
e9a5f03
Update poll question answers translatable fields
javierm Oct 10, 2018
e400cb8
Update site customization pages translatable fields
javierm Oct 10, 2018
981b13a
Update widget cards translatable fields
javierm Oct 10, 2018
f2d6483
Simplify methods defining translation styles
javierm Oct 10, 2018
1ab3b7f
Don't force translations for the current locale
javierm Oct 10, 2018
a38eac0
Refactor globalize models code using a concern
javierm Oct 11, 2018
937cf0b
Validate both the model and its translations
javierm Oct 11, 2018
362157d
Add I18nContent model specs
aitbw Jul 30, 2018
9b19a4e
Extract translation logic to helper method
aitbw Jul 31, 2018
ff6e8c9
Move flat_hash to I18nContent model
raul-fuentes Aug 9, 2018
64dbf55
Fix Rubocop warnings [ci skip]
aitbw Aug 9, 2018
3c033d0
Improve readability for I18nContent#begins_with_key spec
aitbw Aug 16, 2018
ae9cad3
Avoid ternary operator usage when appending/creating I18n keys
aitbw Aug 20, 2018
4af5e1d
Improve I18nContent#flat_hash readability using concise variable names
aitbw Aug 20, 2018
1f03338
Refactor `globalize_locales` partials to increase DRYness
javierm Oct 11, 2018
8748401
Update information texts translatable fields
javierm Oct 11, 2018
a48db19
Show error message for just the displayed locale
javierm Oct 11, 2018
2658bb5
Wrap translation fields in a div
javierm Oct 11, 2018
28ed6aa
Make private methods private
javierm Oct 11, 2018
7b9b650
Fix ambiguous field in test
javierm Oct 11, 2018
01ed66e
Fix alignment in last translatable fields
javierm Oct 15, 2018
1c75df9
Fix updating translatables without current locale
javierm Oct 15, 2018
015cdcc
Simplify creating a process in questions specs
javierm Oct 15, 2018
3165b9b
Fix legislation options not being updated
javierm Oct 15, 2018
b024363
Fix removing an option for legislation questions
javierm Oct 15, 2018
9fc2357
Extract method in translatable builder
javierm Oct 15, 2018
44f71b2
Fix rubocop line too long warning
javierm Oct 15, 2018
ed990c2
Fix "Add option" link position
javierm Oct 15, 2018
f475f4f
Remove reference to site customization page locale
javierm Oct 15, 2018
9aa07e3
Follow naming conventions for HTML classes and IDs
javierm Oct 15, 2018
d10f07b
Make it easier to know destroy_field is an input
javierm Oct 15, 2018
cf4c30b
Prefix classes used in JavaScript with "js-"
javierm Oct 15, 2018
98cfe8c
Remove question option uniqueness validation
javierm Oct 16, 2018
0c1228a
Fix crash with no translation for default locale
javierm Oct 16, 2018
7f5f144
Don't run specs if there are custom fallbacks
javierm Oct 16, 2018
b745ddc
Simplify code checking whether to enable a locale
javierm Oct 17, 2018
c8d3c8f
Use `detect` instead of `select.first`
javierm Oct 17, 2018
0f759f1
Extract method to render form fields for a locale
javierm Oct 17, 2018
8f4d600
Fix spec assuming German isn't available
javierm Oct 23, 2018
c9fadc7
Fix poll question with non-underscored locales
javierm Oct 23, 2018
c774ae6
Add task to migrate data to translation tables
javierm Oct 5, 2018
232d5b0
Migrate custom pages data to their locale
javierm Oct 5, 2018
b990620
Use `migrate_data` option for globalize
javierm Oct 17, 2018
9b671a8
Log failed data migrations
javierm Oct 17, 2018
10b0d82
Add task to simulate data migration
javierm Oct 17, 2018
adf03b9
Don't abort the migration if the simulation fails
javierm Oct 22, 2018
70195a1
Fix bug with non-underscored locales
javierm Oct 22, 2018
bf79ddb
Remove rubocop_todo file
javierm Oct 26, 2018
6a42f6f
Add basic rubocop configuraton for Hound
javierm Oct 26, 2018
a7a9355
Enable SCSS rules in Hound
javierm Oct 26, 2018
dc13533
Make Capybara check the page between comment votes
javierm Aug 8, 2018
a8d2fba
Remove described class cop
javierm Oct 29, 2018
bfe9ae6
Add counter of emails sent to newsletter preview
voodoorai2000 Oct 24, 2018
ac7d1eb
Increase delayed jobs max run time
voodoorai2000 Oct 24, 2018
816f0c5
Adds new social share partial for proposals
decabeza Oct 31, 2018
1a15cb6
Refactors social meta tags spec
decabeza Oct 31, 2018
745c9cd
Don't check already present page content
javierm Aug 29, 2018
54950d1
Add Changelog for release 0.17
voodoorai2000 Oct 31, 2018
a218f8c
Improves some code format details
decabeza Oct 30, 2018
79e1ec4
Fixes houndci-bot warnings
decabeza Oct 30, 2018
160ca31
Update version number for consul.json
voodoorai2000 Oct 31, 2018
f4c35eb
Add one more PR to Changelog
voodoorai2000 Oct 31, 2018
cb2b2ac
Merge branch 'master' into i18n-uptade-crowdin
decabeza Nov 5, 2018
f79f219
Fix date translations
voodoorai2000 Nov 6, 2018
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
Prev Previous commit
Next Next commit
Add I18nContent model specs
  • Loading branch information
aitbw authored and decabeza committed Nov 5, 2018
commit 362157d56eb0233968c989a3f83a18eca9071826
5 changes: 2 additions & 3 deletions app/models/i18n_content.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class I18nContent < ActiveRecord::Base

scope :by_key, -> (key){ where(key: key) }
scope :begins_with_key, -> (key){ where("key ILIKE ?", "#{key}?%") }
scope :by_key, ->(key) { where(key: key) }
scope :begins_with_key, ->(key) { where("key ILIKE ?", "#{key}%") }

validates :key, uniqueness: true

Expand Down
76 changes: 76 additions & 0 deletions spec/models/i18n_content_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
require 'rails_helper'

RSpec.describe I18nContent, type: :model do
let(:i18n_content) { build(:i18n_content) }

it 'is valid' do
expect(i18n_content).to be_valid
end

it 'is not valid if key is not unique' do
new_content = create(:i18n_content)

expect(i18n_content).not_to be_valid
expect(i18n_content.errors.size).to eq(1)
end

context 'Scopes' do
it 'return one record when #by_key is used' do
content = create(:i18n_content)
key = 'debates.form.debate_title'
debate_title = create(:i18n_content, key: key)

expect(I18nContent.all.size).to eq(2)

query = I18nContent.by_key(key)

expect(query.size).to eq(1)
expect(query).to eq([debate_title])
end

it 'return all matching records when #begins_with_key is used' do
debate_translation = create(:i18n_content)
debate_title = create(:i18n_content, key: 'debates.form.debate_title')
proposal_title = create(:i18n_content, key: 'proposals.form.proposal_title')

expect(I18nContent.all.size).to eq(3)

query = I18nContent.begins_with_key('debates')

expect(query.size).to eq(2)
expect(query).to eq([debate_translation, debate_title])
expect(query).not_to include(proposal_title)
end
end

context 'Globalize' do
it 'translates key into multiple languages' do
key = 'devise_views.mailer.confirmation_instructions.welcome'
welcome = build(:i18n_content, key: key, value_en: 'Welcome', value_es: 'Bienvenido')

expect(welcome.value_en).to eq('Welcome')
expect(welcome.value_es).to eq('Bienvenido')
end

it 'responds to locales defined on model' do
expect(i18n_content).to respond_to(:value_en)
expect(i18n_content).to respond_to(:value_es)
expect(i18n_content).not_to respond_to(:value_de)
end

it 'returns nil if translations are not available' do
expect(i18n_content.value_en).to eq('Text in english')
expect(i18n_content.value_es).to eq('Texto en español')
expect(i18n_content.value_nl).to be(nil)
expect(i18n_content.value_fr).to be(nil)
end

it 'responds accordingly to the current locale' do
expect(i18n_content.value).to eq('Text in english')

Globalize.locale = :es

expect(i18n_content.value).to eq('Texto en español')
end
end
end