stefansenk / spree-blogging-spree

Basic blog + news archive functionality for Spree E-Commerce app.
BSD 3-Clause "New" or "Revised" License
28 stars 79 forks source link

Translations #2

Open asecondwill opened 10 years ago

asecondwill commented 10 years ago

This works great - I've been searching all arvo for a spree blog gem. thanks!

Do you have any plans to enable translations with spree I18N / globalise?

stefansenk commented 10 years ago

Hi asecondwill. I don't currently have any plans to add further translation features. Hopefully the majority of the text used in the gem comes from the locale yml files, so that should be a good start. I think the next step would be to add support for translations on the models if the spree_i18n gem is loaded. Presumably that would be the BlogEntry model fields for title, body and summary. Is that what you had in mind?

asecondwill commented 10 years ago

Hi, Yep thats exactly it.

momolog commented 10 years ago

+1 This would be very interesting for me, too!

picazoH commented 9 years ago

+1

mmintel commented 8 years ago

Hi there! First off: thanks for this plugin here! I also wanted to add translations and tried it myself.

First I created a file named blog_entry_decorator.rb in models/spree containing this code:

Spree::BlogEntry.class_eval do
    translates :title, :body, :summary
end

Then I added this migration here

class AddTranslationsToBlogEntries < ActiveRecord::Migration
  def up
    Spree::BlogEntry.create_translation_table!({
        :title => :string, :body => :text, :summary => :text
      }, {
        :migrate_data => true
      })
  end
end

is that correct? how can I add the translation fields to the admin view?

Best regards

forever-sumit commented 8 years ago

@mmintel you need to override the view part of this gem as well and use the same procedure to add translations as you can do with a normal rails application. and as suggested by the

globalize gem

you can take help with this gem Spree Globalize