aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/translation_helper.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove :rescue_format option for translate helper since it's no longer ↵Bernard Potocki2015-05-041-2/+2
| | | | supported by I18n.
* Handle raise flag in translate when both main and default translation is ↵Bernard Potocki2015-05-041-4/+4
| | | | missing. Fixes #19967
* Correct translate helper docs [ci skip]Derek Prior2015-04-241-23/+36
| | | | | | | | | | | | | | | | | | 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.
* Allow an array to be a default translation value.Adam Prescott2015-04-041-1/+1
| | | | | | | | | | | 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.
* Merge pull request #19421 from jcoyne/translate_defaults_with_nilRafael Mendonça França2015-03-201-1/+1
| | | | Strip nils out of default translations. Fixes #19419
* Fix regression when passing a value different of String.Ulisses Almeida2015-02-261-1/+5
| | | | | | | | | | | | | | | | | 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.
* Merge pull request #17676 from ↵Rafael Mendonça França2015-01-051-6/+8
|\ | | | | | | | | | | tigrish/fix_custom_i18n_exception_handler_regression Fix I18n regression introduced by #13832
| * Fix I18n regression introduced by #13832Christopher Dell2014-11-191-6/+8
| | | | | | | | Previously, when the `:raise` options was set to `false`, it would get overwritten to `true`, preventing custom exception handlers to be used.
* | Unsafe default translations should not be marked html_safeJustin Coyne2015-01-021-19/+9
|/ | | | | | 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
* fix the undefined method content_tag #15245Rajarshi Das2014-09-061-0/+1
| | | | not required include ActionView::Helpers::TagHelper in test as well
* Missing ActiveSupport require for calling String#firstAkira Matsuda2014-08-141-0/+1
|
* Fix assertion order and :scissors: extra spacesCarlos Antonio da Silva2014-05-131-2/+1
|
* Dup options hash to prevent modificationsJosep Jaume Rey2014-05-131-0/+2
| | | | `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.
* Rails config for raise on missing translationsKassio Borges2014-01-271-4/+4
| | | | | Add a config to setup whether raise exception for missing translation or not.
* Escalate missing error when :raise is trueShota Fukumori (sora_h)2013-12-051-1/+9
| | | | | | | | | | | | | | Before ec16ba75a5493b9da972eea08bae630eba35b62f, 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
* Stop using i18n's built in HTML error handling.Michael Koziarski2013-12-021-13/+9
| | | | | | | | | 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
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-201-0/+107