1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

18 commits

Author SHA1 Message Date
Kir Shatrov
0f138d1a8b Include interpolation values to translation_missing helper 2015-09-18 20:04:36 +03:00
Bernard Potocki
3d8b783d13 Remove :rescue_format option for translate helper since it's no longer supported by I18n. 2015-05-04 23:46:25 +02:00
Bernard Potocki
9c8542bb12 Handle raise flag in translate when both main and default translation is missing. Fixes #19967 2015-05-04 22:26:07 +02:00
Derek Prior
6ad5e7ebeb
Correct translate helper docs [ci skip]
The documentation previously stated that calling `translate(".foo")` was
equivalent to calling `I18n.translate("people.index.foo")` which is
incorrect due to the various other functions of the `translate` view
helper. This has been fixed.

Additionally, a note about forcing the view helper to re-raise
exceptions was added to the section detailing the handling of missing
translations.

Other cleanup includes:

* Consistent formatting of code
* Stop indenting bulleted list as a code sample
* Tighten some of the language
* Wrap at 80 characters.
2015-04-24 11:45:35 -04:00
Adam Prescott
6f3c65f630 Allow an array to be a default translation value.
4.2.1 introduced a change to the way `translate`/`t` works with an
option of `default: [[]]`. In 4.2.0, this would give a default value of
`[]`, but in 4.2.1, it leads to a missing translation.

`default: [[]]` is again allowed for cases where a default of `[]` is
needed.

This addresses GitHub issue 19640.
2015-04-04 12:46:45 -04:00
Rafael Mendonça França
7815fe4634 Merge pull request #19421 from jcoyne/translate_defaults_with_nil
Strip nils out of default translations. Fixes #19419
2015-03-20 18:00:01 -03:00
Ulisses Almeida
362557eb41 Fix regression when passing a value different of String.
The previous version of rails(4.2.0) you can pass objects
to the default option of translation helper.

For example:

```ruby
  t('foo', default: 1)
```

But on rails 4.2.1 version this kind of use stopped to work,
because started only to accept String types.

Now with this fix we can use orther value types on this
helper again.
2015-02-26 19:04:00 -03:00
Rafael Mendonça França
d76bf34b04 Merge pull request #17676 from tigrish/fix_custom_i18n_exception_handler_regression
Fix I18n regression introduced by #13832
2015-01-05 14:35:50 -03:00
Justin Coyne
fab50c130b Unsafe default translations should not be marked html_safe
Previously default translation keys that didn't end in `_html`, but came
after a missing key that ended in `_html` were being returned as
html_safe. Now they are not. Fixes #18257
2015-01-02 17:07:01 -06:00
Christopher Dell
4dbce79e95 Fix I18n regression introduced by #13832
Previously, when the `:raise` options was set to `false`, it would get overwritten to `true`, preventing custom exception handlers to be used.
2014-11-19 16:33:50 +01:00
Rajarshi Das
ab2ace6bbe fix the undefined method content_tag #15245
not required include ActionView::Helpers::TagHelper in test as well
2014-09-06 12:09:01 +05:30
Akira Matsuda
1a299b6ca6 Missing ActiveSupport require for calling String#first 2014-08-14 01:06:34 +09:00
Carlos Antonio da Silva
c4c5801bd9 Fix assertion order and ✂️ extra spaces 2014-05-13 12:09:11 -03:00
Josep Jaume Rey
6caf3ab51b Dup options hash to prevent modifications
`options[:default]` and `options[:raise]` can be mistakenly added to the `options` hash. This can be a problem if you're reusing the same object.
2014-05-13 14:13:36 +02:00
Kassio Borges
433628a45c Rails config for raise on missing translations
Add a config to setup whether raise exception for missing translation or
not.
2014-01-27 08:03:46 -02:00
Shota Fukumori (sora_h)
c1d5477b63 Escalate missing error when :raise is true
Before ec16ba75a5,
ActionView::Helpers::TranslationHelper#translate has raised errors with
specifying options[:raise] to true.

This should work by this fix:

     begin
       t(:"translations.missing", raise: true)
     rescue I18n::MissingTranslationData
       p :hello!
     end
2013-12-05 09:20:58 +09:00
Michael Koziarski
0c7ac34aed Stop using i18n's built in HTML error handling.
i18n doesn't depend on active support which means it can't use our html_safe
code to do its escaping when generating the spans.  Rather than try to sanitize
the output from i18n, just revert to our old behaviour of rescuing the error
and constructing the tag ourselves.

Fixes: CVE-2013-4491
2013-12-02 16:42:16 -08:00
Piotr Sarnacki
0d6e8edc2a Move actionpack/lib/action_view* into actionview/lib 2013-06-20 17:23:15 +02:00
Renamed from actionpack/lib/action_view/helpers/translation_helper.rb (Browse further)