Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use i18n key as default translation in Rails 3?

For example:

I18n.t('something')

should output only

something

if the translation missing.

like image 854
bUg. Avatar asked Nov 02 '10 02:11

bUg.


People also ask

What is the difference between i18n and l10N?

To sum up, the distinction between these terms is the following: Localization (l10N) involves adapting your product or content to particular locales. Internationalization (i18n) is the process of preparing your software-based product for localization.

What is i18n translation?

Internationalization (sometimes shortened to "I18N , meaning "I - eighteen letters -N") is the process of planning and implementing products and services so that they can easily be adapted to specific local languages and cultures, a process called localization .

What is i18n key?

Translation keys are a critical component of the internationalization (i18n) process. They act as IDs that reference pieces of displayable text, allowing strings that require translation to be easily swapped out based on locale instead of being hardcoded into the software.

What is i18n in Ruby?

The Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single custom language other than English or for providing multi-language support in your application.


1 Answers

It is possible: See section 4.1.2 Defaults at Rails Internationalization (I18n) API.

I18n.t :missing, :default => 'Not here'
# => 'Not here'
like image 142
David Avatar answered Oct 20 '22 00:10

David