Giter Club home page Giter Club logo

refinerycms-translations's Introduction

RefineryCMS Translations

A simple approach to content translation for [RefineryCMS](refinerycms.org).

Features:

  • Mark string or block as translatable in you view, key-value * locale.

  • Let the end-user translate from Refinery backend

  • On the first request that need translation, locale for every language is created

  • You can define translated string to be edited with text_field or WYMeditor in the backend.

  • Translation are cached

  • When the content change, the translation is marked as out-dated to ease site maintenance.

Install

Install the plugin

Add this line to your Gemfile:

For the latest version use

gem 'refinerycms-translations', :git => '[email protected]:seasonlabs/refinerycms-translations.git'

For stable version

gem 'refinerycms-translations', '~> 0.3'

Install the gem

bundle install

Copy the migration file

rails generate refinerycms_translations

Run the migration

rake db:migrate

Make sure you have correctly set the following setting in Refinery: ‘i18n_frontend_translation_locales’, ‘i18n_translation_default_frontend_locale’

Usage

Given the following code in you view:

<h1><%= RefinerySetting.site_name %></h1>;

You can do:

<h1><%= Translation.for_string('site name', RefinerySetting.site_name) %></h1>;

Or for more complex text:

<div id='footer'>
<p>Please give us a call! 1-877-555-1234</p>
<p>Copyright 2010 - Your Company Name</p>;
</div>

Using a block:

<div id='footer'>
<% Translate.for_block('footer') do %>
<p>Please give us a call! 1-877-555-1234</p>
<p>Copyright 2010 - Your Company Name</p>
<% end %>
</div>

Note: for_string and for_block both take the option “wym” argument to edit the translation with the WYM editor. for_block default to true, for_string default to false.

Based on code from github.com/unixcharles

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.