Commit Graph

16 Commits

Author SHA1 Message Date
voodoorai2000
59b35156b1 Fix flaky spec
`I18n.available_locales=` does a little magic[1] and was causing some flakieness along the way, as the `:wl` locale persisted in future specs

Thanks for the heads up @javierm 👌

[1] https://www.rubydoc.info/github/svenfuchs/i18n/I18n%2FConfig:available_locales=
2018-10-09 22:15:05 +02:00
voodoorai2000
9d7042c5ae Adds missing language name translations 2018-10-05 18:08:47 +02:00
voodoorai2000
0a0261900c Display language name or language key
There where two issues with the current implementation:

- There was a possible duplication between looking up the language name in key "locale" and in key "i18n.language.name"

- The "default" option was not being picked up, as the fallback always returned the default locale's translation, "English"

With this implementation there is only a single place to put the language name: i18n.language.name. I think this place is easier to find and understand for Crowdin translators than a "locale" key hidden in general.yml

If the translation is not found we display the language key, instead of English, which makes more sense to me too 😌

Solution based on recent comments[1] on a related I18n issue

[1] https://github.com/svenfuchs/i18n/issues/365#issuecomment-419263847
2018-10-05 18:08:41 +02:00
Javi Martín
1ffaa680a3 Create correct translation when visiting root page
We set `I18n.locale = :en` before each test, and so creating a new card
will automatically create English translations.

So visiting the Spanish page won't show the card, since no Spanish
translation exists for it. If we visit the klingon page after doing so,
the last used locale (Spanish) will still be used, and so the test will
fail.

Specifically creating Spanish translations instead of the English ones
makes the translations visible when visiting the Spanish homepage.
2018-09-26 16:09:09 +02:00
decabeza
304143d051 Updates localization and home specs 2018-05-29 13:22:23 +02:00
Bertocq
34bb9d65b1 Enable RSpec/NotToNot cop and fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
2018-01-07 17:39:48 +01:00
Bertocq
c4aa2d7093 Enable RSpec/MessageExpectation cop & fix issues
There was 34 `allow` occurences and 17 `expect` occurences, so to be consistent `allow` form was chosen.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
2018-01-07 16:36:18 +01:00
decabeza
dd0452ece6 updates texts on specs 2017-09-01 13:18:56 +02:00
kikito
b6af10a91f refactors localization spec using expect instead of global state 2015-10-20 19:08:52 +02:00
Alberto Garcia Cabeza
f1e95addaa Changes tests and comments unused keys 2015-09-10 19:29:05 +02:00
Juanjo Bazán
5af7bc1aee removes language switcher if only one locale 2015-09-03 23:47:55 +02:00
Alberto Garcia Cabeza
b0f7d74c47 Changes site language test, comment unused keys 2015-08-31 21:55:23 +02:00
kikito
934512ad7a made the locale switcher use less js, more ruby & html 2015-08-28 17:02:06 +02:00
Alberto Garcia Cabeza
42a0cffefc Adds new texts on header, debates and footer 2015-08-27 17:11:01 +02:00
Juanjo Bazán
b2f29215ee unifies localization specs 2015-08-19 22:51:58 +02:00
Fernando Seror
a89d621d1d Allow locale to be set through the front-end
* Store the last used locale in the session
* Allow home page to be identified in helpers even when containing
  parameters
* Create initializer to explicitly set the available locales, the
  default and the load_path
2015-08-05 15:43:39 -05:00