Skip to content

sniemela/radiant-globalize2-extension

 
 

Repository files navigation

Radiant Globalize2 Extension

About

An extension by Aissac that helps translating content in Radiant CMS using the Globalize2 Rails Plugin.

Requires Radiant >= 0.8. Tested on Radiant 0.9.1.

Check out a screencast presenting the extension and one on compatibility issues

Features

  • Provides the ability to translate your pages (title, slug, breadcrumb, description, keywords) using the Radiant admin interface.
  • Provides the ability to translate your snippets and layouts using the Radiant admin interface.
  • Radius tags for accessing the locales and translations.
  • Possibility to completely delete the translation for a page.

Important Notice!

The git branches of this repository hold stable versions of the extension for older versions of Radiant CMS. For example the 0.8 branch is compatible with Radiant 0.8.

To checkout one of these branches:

git clone git://github.com/Aissac/radiant-globalize2-extension.git vendor/extensions/globalize2
cd vendor/extensions/globalize2
git checkout -b <branch-name> origin/<remote-branch-name>

As an example, if you're working on Radiant 0.8 you will need to checkout the 0.8 branch:

cd vendor/extensions/globalize2
git checkout -b my_branch origin/0.8

Installation

Globalize2 Extension has no known dependencies. Globalize2 Rails Plugin is bundled.

Because Globalize2 Extension keeps the settings in the Radiant::Config table it is highly recommended to install the Settings Extension

git clone git://github.com/Squeegy/radiant-settings.git vendor/extensions/settings

Finally, install Globalize2 Extension

git clone git://github.com/Aissac/radiant-globalize2-extension.git vendor/extensions/globalize2

Then run the rake tasks:

rake radiant:extensions:globalize2:migrate
rake radiant:extensions:globalize2:update

Configuration

###Settings

Globalize2 Extension keeps its settings in Radiant::Config table, so in order to use correctly the extension you need to create some settings:

Radiant::Config['globalize.default_language'] = 'en'
Radiant::Config['globalize.languages'] = 'ro,de'

Usage

You have the possibility to change the locale either on the pages/snippets/layouts index page, or on the page/snippet/layout edit page. Changing the locale using either option will change the locale for the entire application.

When you need to delete a translation, on the page edit action, you need to check the "Delete Translation" checkbox, before saving the page. Saving the page with the checked "Delete Translation" will erase only the translation for that particular locale.

When creating a new page, the locale will be changed automatically to the default language.

###Available Tags

  • See the "available tags" documentation built into the Radiant page admin for more details.
  • Use the <r:locale /> tag to render the current locale.
  • Use the <r:locales /> tag to render the locales you use in the application.
  • Use the <r:with_locale /> tag to temporarly switch the locale within the block.
  • Use the <r:if_translation_title /> and <r:unless_translation_title /> tags to render the page only if/unless the title is translated.
  • Use the <r:if_translation_content /> and <r:unless_translation_content /> tags to render the page only if/unless the content is translated.
  • If you pass to <r:link /> tag the locale attribute it will generate the link to the translated version of the current document
  • The <r:children:each /> tag cycles through all of the translated children. If you need to cycle through all the children (regardless if they are translated or not) set the tag's locale attribute to false
  • If you're using the Paginate Extension, the <r:paginate:each /> tag will find only translated children. If you need to find all the children (regardless if they are translated or not) set the tag's locale attribute to false

Compatibility

The following extensions were tested and work with Globalize2 Extension:

You need to load Copy-Move before Globalize2

config.extensions = [ :copy_move, :globalize2, :all ]

You need to load Custom Fields before Globalize2

config.extensions = [ :custom_fields, :globalize2, :all ]

You need to migrate Reorder extension before Globalize2

You need to load Paginate before Globalize2

config.extensions = [ :paginate, :globalize2, :all ]

You need to install Globalize2Paperclipped Extension. Follow the installation notes on the extension's official page.

Because Tiny Paper is based on Paperclipped, you neeed to install Globalize2Paperclipped.

Out-of-the-box compatible

Other extensions that have been tested and don't need any special treatment: Mailer Extension, Stereotype Extension, SNS Extension, SNS Minifier, SNS SASS Filter Extension, Database Mailer Extension, Super Export Extension

TODO

Contributors

About

Translate content in Radiant CMS using the Globalize2 Rails plugin.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%