From carsten at sarum.dk Sat Jan 3 12:25:02 2009 From: carsten at sarum.dk (Carsten Gehling) Date: Sat, 3 Jan 2009 18:25:02 +0100 Subject: [Rails I18n] Script to extract text from application Message-ID: I accidentally posted this question in the Rails forum, but it might fit better here... I have a Rails application, that has grown quite large. At the moment all texts are placed inside the template files like this:

This is a header

And inside the ruby code (like flash messages, model error messages, etc.) I now have the situation, that I want to place all text in an external textfile in order to be able to e.g. translate the entire site. Is there an easy way to extract all these texts and replace them with e.g. l(:some_text_key) in the ruby code and <%=l(:some_text_key) in the templates? or do I have to go through all files manually? (yikes) BTW: I will happily move to Rails 2.2 if that is any help. - Carsten -- Posted via http://www.ruby-forum.com/. From thedickster at gmail.com Sat Jan 3 12:55:01 2009 From: thedickster at gmail.com (Richard Schneeman) Date: Sat, 3 Jan 2009 18:55:01 +0100 Subject: [Rails I18n] different view based on different model Message-ID: <21fe6b2eab04ab80f7c7886b523e6984@ruby-forum.com> I have a view that looks like this "Add a New #{@element.class}" where my class can be "definition", "phrase", etc. I want to do something like <%= t 'new.form. at element.class'%> so when @element is a "phrase" my view would show "Add New Phrase", When my @element is a "definition" my view needs to be "Add New Definition" Is this possible? -- Posted via http://www.ruby-forum.com/. From thedickster at gmail.com Sun Jan 4 14:56:21 2009 From: thedickster at gmail.com (Richard Schneeman) Date: Sun, 4 Jan 2009 20:56:21 +0100 Subject: [Rails I18n] different view based on different model In-Reply-To: <21fe6b2eab04ab80f7c7886b523e6984@ruby-forum.com> References: <21fe6b2eab04ab80f7c7886b523e6984@ruby-forum.com> Message-ID: <5c2a2515ce777c8e1cf6903a101bc29e@ruby-forum.com> This forum must really not get much traffic. Anywhoo, I solved my own problem <% type_of_element = @element.class.to_s.downcase %> <% add_element_to_translate = ["model", "add", type_of_element ].compact.join('.')%> <%= t add_element_to_translate %> hopes this helps someone else, if you figure out a better way let me know!! -- Richard http://www.slangslang.com -- Posted via http://www.ruby-forum.com/. From thedickster at gmail.com Sun Jan 4 14:56:49 2009 From: thedickster at gmail.com (Richard Schneeman) Date: Sun, 4 Jan 2009 20:56:49 +0100 Subject: [Rails I18n] Passing a dynamic class to translate In-Reply-To: References: Message-ID: <1480850b31f650e6ed5f17769146fbad@ruby-forum.com> figured it out... <% type_of_element = @element.class.to_s.downcase %> <% add_element_to_translate = ["model", "add", type_of_element ].compact.join('.')%> <%= t add_element_to_translate %> hopes this helps someone else, if you figure out a better way let me know!! -- Richard http://www.slangslang.com -- Posted via http://www.ruby-forum.com/. From thedickster at gmail.com Wed Jan 7 19:17:58 2009 From: thedickster at gmail.com (Richard Schneeman) Date: Thu, 8 Jan 2009 01:17:58 +0100 Subject: [Rails I18n] Nested Sentance translation Message-ID: I want to have a sentence that contains elements i already have translations for. I already have: <%= t 'nested' %> <%= t 'be_cool' %> This is my sentance: "This is an example of where nested translations would be cool." Is there anyway to have something like this in my yml file?? en: nested: "nested" be_cool: "be Cool" the_sentence_with_nested_elements: "This is an example of where <%= t 'nested' %> translations would <%= t 'be cool' %>." Any help or insight is appreciated, If this isn't possible...let me know!! -- Posted via http://www.ruby-forum.com/. From chaser at redspectre.net Tue Jan 13 14:25:43 2009 From: chaser at redspectre.net (Christian Richter) Date: Tue, 13 Jan 2009 20:25:43 +0100 Subject: [Rails I18n] Automatically detect client's locale setting In-Reply-To: <66bcc1fc365e886ca685c1af1f014588@ruby-forum.com> References: <66bcc1fc365e886ca685c1af1f014588@ruby-forum.com> Message-ID: <86918d3c171ac6329ba21589af530946@ruby-forum.com> Hi Fernando, had the same problem, but solving was quite easy: I18n.locale = request.headers['HTTP_ACCEPT_LANGUAGE'].split(',')[0].split('-')[0] greetings Christian Fernando Perez wrote: > Hi, > > Does I18n provide any easy feature to detect the client's browser > locale? -- Posted via http://www.ruby-forum.com/. From chaser at redspectre.net Tue Jan 13 14:28:59 2009 From: chaser at redspectre.net (Christian Richter) Date: Tue, 13 Jan 2009 20:28:59 +0100 Subject: [Rails I18n] I18n available Transalation Databases Message-ID: Hi Folks, i have a little Problem, i want my application to autogenerate a liste of available languages/translation databases, somewhere on the net somebody mentioned the use of I18n.candidates, unfortunatly that doesn't work, anybody knows where rails stores the available languages? Thanks & Greetings Christian -- Posted via http://www.ruby-forum.com/. From ramanan.neelakantan at gmail.com Wed Jan 14 17:28:40 2009 From: ramanan.neelakantan at gmail.com (Flash It) Date: Wed, 14 Jan 2009 23:28:40 +0100 Subject: [Rails I18n] Some hyperlink dont work in Safari Message-ID: I am working on a consumer review web site http://www.consupo.com. For some reason, the links on this page http://www.consupo.com/cases/cases_by_category/restaurants/D doesn't work on safari. It works fine on IE and Mozilla. Does any one faced similar issues on Safari? Thanks -- Posted via http://www.ruby-forum.com/. From jarkko at jlaine.net Thu Jan 15 02:06:42 2009 From: jarkko at jlaine.net (Jarkko Laine) Date: Thu, 15 Jan 2009 09:06:42 +0200 Subject: [Rails I18n] Some hyperlink dont work in Safari In-Reply-To: References: Message-ID: On 15.1.2009, at 0.28, Flash It wrote: > I am working on a consumer review web site http://www.consupo.com. > For > some reason, the links on this page > http://www.consupo.com/cases/cases_by_category/restaurants/D doesn't > work on safari. It works fine on IE and Mozilla. Does any one faced > similar issues on Safari? 1) This list is for discussion about Rails internationalization and localization. You should direct your question to the general Rails mailing list at http://groups.google.com/group/rubyonrails-talk 2) You need to be more specific. That page is full of links. Which one of them doesn't work for you? Do any of them? Which version of Safari? What do you mean by "don't work"? For the record, I didn't find any broken links either on Webkit nightly or Safari 3, but I don't have the stamina to go through all of the links. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://odesign.fi Check out my latest book, Unobtrusive Prototype, fresh off the Peepcode oven: http://peepcode.com/products/unobtrusive-prototype-js From vikasg at aflatune.com Fri Jan 16 00:09:21 2009 From: vikasg at aflatune.com (Vikas Gholap) Date: Fri, 16 Jan 2009 06:09:21 +0100 Subject: [Rails I18n] how to use onsubmit in remote_form_for.....????????? Message-ID: <0e0ec5e51927da6b3a73b1b17152b607@ruby-forum.com> I want to check whether textfield is empty or not at onsubmit event of form, but it is not working. Can any one tell me how to check empty textfield on remote_form_for's onsubmit event??????????????????????? my code is ---------------> <%remote_form_for(:comments, @comment, :url => @commentUrl, :html => {:method => :post, :onsubmit => 'if ($("comments_comment").value == "") {showNotificationMessage("Please enter comment", Notification.Error, comments_comment); return false;}'}) do |f| %> <%= f.text_area "comment", :rows => 2, :style=>"width:100%;padding-right:8px;margin-top:8px;margin-bottom:8px;" %> <%=submit_to_remote f, "Add comment", :url => @commentUrl, :update => { :success => divID, :failure => divID }%> <%end%> 'onsubmit' is not excuted during form submit. Any one can help me. -- Posted via http://www.ruby-forum.com/. From rubyforum at thisisnotmyrealemail.com Fri Jan 16 09:52:56 2009 From: rubyforum at thisisnotmyrealemail.com (Joao Silva) Date: Fri, 16 Jan 2009 15:52:56 +0100 Subject: [Rails I18n] need XSLT help Message-ID: is there any tool which will generate XSLT for converting from XML to fixed lenght Text format.I mean is there any IDE which will let us drag and drop the contents of XML and set some properties and give us the XSLT code Thanks -- Posted via http://www.ruby-forum.com/. From saurav at cipher-tech.com Fri Jan 16 10:34:40 2009 From: saurav at cipher-tech.com (Kumar Saurav) Date: Fri, 16 Jan 2009 16:34:40 +0100 Subject: [Rails I18n] How to refresh Image through ajax request Message-ID: Hi all , I am very new for ruby. I am using Ajax Request(Rmagick in controller) for changing image on my DIV but the problem is it refresh for first time only then after i have to refresh the browser always. If anybody having any solution, Please let me know . I am posting my code here Code in rhtml file ================================================================================== <%= form_remote_tag({:url=>{:controller=>'image_builders', :action =>'index'}, :update =>'photo'})%>
Type
<%= submit_tag 'Create Image' %>
=============================================================================== code in controller def index @Rows =20 @Cols = 120 @alpha = params[:alpha].to_i @margin = params[:margin].to_i if params[:height].to_i >9000 || params[:width].to_i > 9000 if params[:height].to_i >9000 params[:height] = 8999 end if params[:width].to_i > 9000 params[:width] = 8999 end end if params[:height] && params[:width] @Rows =params[:height].to_i @Cols = params[:width].to_i end @Start = params[:input_field_1] @End = params[:input_field_2] if params[:type] == 'gradation' fill = Magick::GradientFill.new(0, 0, 0, @Cols, @Start, @End) img = Magick::Image.new(@Rows, @Cols, fill) img.opacity = @alpha/ 127.0 * Magick::TransparentOpacity if @alpha != 0 img_new = img.rotate(90) if params[:reverse] img_rev = img_new.rotate(270) img_rev.write("public/images/xyz.jpg") render :text => "" else img_new.write("public/images/xyz.jpg") render :text => "" end end end ================================================================================ Thanks in Advance -- Posted via http://www.ruby-forum.com/. From tinucleatus at gmail.com Tue Jan 27 00:16:00 2009 From: tinucleatus at gmail.com (Tinu Cleatus) Date: Tue, 27 Jan 2009 06:16:00 +0100 Subject: [Rails I18n] i18n with Active record Message-ID: <43b40a2518a87b6f0cffeb3803a09db9@ruby-forum.com> Hello all, I am working on a new app where I need to implement internationalization. But the thing is a bit complicated. That is, initially there will be a few language translations available but later the user needs to be able to edit existing translations on his account and also needs to be able to add new language translations. So this needs the translations to be stored in the database. Is there a plugin which I can make use of? Any suggestions are greatly appreciated. Thanks. -- Posted via http://www.ruby-forum.com/.