# How to Globalize using variants of templates?

**URL:** <https://www.ruby-forum.com/t/how-to-globalize-using-variants-of-templates/99998>\
**Category:** Rails I18n\
**Created:** [July 26, 2006, 3:53pm UTC](https://www.ruby-forum.com/t/how-to-globalize-using-variants-of-templates/99998 "2006-07-26T15:53:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yash\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/7ab992/32.png) [@Yash\_G](https://www.ruby-forum.com/u/Yash_G)\
**Post date:** [July 26, 2006, 3:53pm UTC](https://www.ruby-forum.com/t/how-to-globalize-using-variants-of-templates/99998/1 "2006-07-26T15:53:06Z")

</div>

Hi,

We have a web application running on Ruby on Rails 1.0, with all RHTML  
files stored in the standard app/views/controller directories. The  
static content, messages, etc. in all the templates are in US English.  
We hope to release the website in other languages.  
We are considering the use of the Globalize plugin from  
[http://svn.globalize-rails.org/svn/globalize/globalize/trunk/](http://svn.globalize-rails.org/svn/globalize/globalize/trunk/)  
The layout of the pages is unlikely to change for most of the  
languages. All we need to do is call the translate method for all  
static content as:  
“”.translate to get the text translated in the new language.

However, in case of some languages like Arabic, the entire layout of  
all pages will have to be changed. The RHTMLs themselves will have to  
be different. This may also be the case for some other languages for  
which the static text does not align properly and we are forced to  
create still more variants of the RHTMLs.

How do we make sure our application has a set of default templates  
that are used if the corresponding localized templates are not  
present?  
Is there something we need to do in routes.rb?  
How will Rails locate the template to be used for rendering?

Thanks,  
Yash

---

<div class="post-metadata">

**Author:** ![Yash\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/7ab992/32.png) [@Yash\_G](https://www.ruby-forum.com/u/Yash_G)\
**Post date:** [September 14, 2006, 12:43am UTC](https://www.ruby-forum.com/t/how-to-globalize-using-variants-of-templates/99998/2 "2006-09-14T00:43:55Z")

</div>

Yash G. wrote:

> However, in case of some languages like Arabic, the entire layout of  
> all pages will have to be changed. The RHTMLs themselves will have to  
> be different. This may also be the case for some other languages for  
> which the static text does not align properly and we are forced to  
> create still more variants of the RHTMLs.

Layouts could be switched depending on the Locale.language.direction  
field. Usally its “ltr” and if it is “rtl” you could load a different  
set of stylesheets using a before\_filter in your ApplicationController.

> How do we make sure our application has a set of default templates  
> that are used if the corresponding localized templates are not  
> present?  
> Is there something we need to do in routes.rb?  
> How will Rails locate the template to be used for rendering?

Globalize tries to find templates by the current set locale in that  
format:  
..rhtml If it does not find a file matching that  
convention, then it just uses the .rhtml file.
