SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to use rails "pluralization" with other languages?

    I'm italian and of course now i'm developing my first rails application in italian. Now for models, controllers and action names i'm using english words but i think it would be better to use italian words, expecially for the name of controllers and actions that appears on the browser url bar. So the future italian user of this application can understand also from the url what page he is on to do what.

  2. #2
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use routes for the urls.

  3. #3
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Fenrir2 View Post
    Use routes for the urls.
    you mean that i can modify routes.rb to make for example a "customer/new" (controller/action pair) looks like "cliente/nuovo" in my italian language?

  4. #4
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you can do that:

    Code:
    map.new_customer "cliente/nuovo", :controller => 'customer', :action => 'new'
    This will also give you a "new_customer_url" method for generating the url.

  5. #5
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Fenrir2 View Post
    Yes you can do that:

    Code:
    map.new_customer "cliente/nuovo", :controller => 'customer', :action => 'new'
    This will also give you a "new_customer_url" method for generating the url.
    that is great! So with a route like that i can access the same page with the italian form and also the original english form?
    Is this (modifing routes.rb to make those new mapped url in italian) the best solution to do the url (controller/actions) translation in rails?

  6. #6
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it is. It would be much harder to implement the pluralization rules for your language and you many have problems with plugins etc.

  7. #7
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Fenrir2 View Post
    I think it is. It would be much harder to implement the pluralization rules for your language and you many have problems with plugins etc.
    thank you very much that is an interesting topic useful for non english applications


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •