Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a5d1c24
Try adding workflow actions
anitagraham Apr 28, 2021
4604a67
Minor editing of documentation
anitagraham Jul 15, 2022
495e012
Use matching ruby3 branch of refinerycms while still a work in progress
anitagraham Jul 18, 2022
34d37c2
CI - run on Ruby 3.1
anitagraham Jul 18, 2022
61d05e3
result is a url, not a page
fembem May 4, 2023
584b3f1
it should still work with Ruby 2.7+
parndt May 11, 2023
7496100
Update main.yml
parndt May 11, 2023
a38b2bb
Merge branch 'master' into ruby3
parndt May 12, 2023
fb61870
File.exists? -> File.exist?
parndt May 12, 2023
b674435
Update main.yml
parndt May 12, 2023
52931e3
Merge pull request #2 from fembem/around-generate-method-fix
anitagraham Sep 29, 2023
d3020a5
refactor(branch ruby3): compatible with refinerycms/ruby3
anitagraham Feb 18, 2025
7b8e15d
Merge branch 'master' into ruby3
parndt Dec 30, 2025
2d5a217
Refactor locale setting logic in find_or_set_locale
parndt Dec 31, 2025
0a934f7
Update mobility dependency version constraint
parndt Jan 2, 2026
d915b69
Update routing filter overrides for Rails 8+ support
parndt Jan 2, 2026
efdbc58
Update CI workflow to support new Ruby and database versions
parndt Jan 2, 2026
faf56d9
Enhance routing filter for Rails 7 and 8 compatibility
parndt Jan 2, 2026
0f184f9
Fix routing filter for Rails 7.1 and 8.0 compatibility
parndt Jan 2, 2026
cb28e01
Update routing filter for Rails 7.1 and 8 compatibility
parndt Jan 2, 2026
9709228
Only remove the existing patch if we're overriding it
parndt Jan 2, 2026
ea29ba7
Update refinerycms-i18n.gemspec
parndt Jan 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ jobs:
strategy:
matrix:
database: [ mysql, postgresql ]
ruby: [ 2.7, 2.6 ]
ruby: [ 3.1 ]
fail-fast: false
max-parallel: 10
runs-on: ubuntu-latest

env:
BUNDLE_JOBS: 4
BUNDLE_PATH: vendor/bundle
CI: true
DB: ${{ matrix.database }}
MYSQL_PASSWORD: root
Expand Down
80 changes: 80 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,83 @@ spec/dummy

# Local Gemfile for developing without sharing dependencies
.gemfile
# Rails
.bundle
db/*.sqlite3
db/*.sqlite3-journal
*.log
tmp
tmp/**/*

# Documentation
doc/api
doc/app
.yardoc
.yardopts
coverage

# Public Uploads
public/system/*
public/themes/*

# Public Cache
public/javascripts/cache
public/stylesheets/cache
public/refinery/*

# Vendor Cache
vendor/cache

# Acts as Indexed
index/**/*

# Refinery Specific
*.tmproj
*.autobackupbyrefinery.*
refinerycms-*.gem

# Mac
.DS_Store

# Windows
Thumbs.db

# NetBeans
nbproject

# Eclipse
.project

# Redcar
.redcar

# Rubinius
*.rbc

# Vim
*.swp
*.swo

# RubyMine
.idea

# E-texteditor
.eprj

# Backup
*~

# Capybara Bug
capybara-*html

# sass
.sass-cache
.sass-cache/*

#rvm
.rvmrc
.rvmrc.*

# vendor/extensions dummy applications.
vendor/extensions/**/spec/dummy

5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
source "https://rubygems.org"

gemspec

git "https://github.com/refinery/refinerycms", branch: "master" do
#
git "https://github.com/anitagraham/refinerycms", branch: "ruby3" do
gem "refinerycms"

group :test do
Expand Down
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,37 @@ rails g refinery:i18n

```ruby
Refinery::I18n.configure do |config|
config.default_locale = :en
config.default_locale = :en

# config.current_locale = :en

# config.default_frontend_locale = :en

config.frontend_locales = [:en,:ar]
config.frontend_locales = [:en, :ar]

config.locales = {:en=>"English", :ar=>"Arabic"}
#, :nl=>"Nederlands", :pt=>"Português", :"pt-BR"=>"Português brasileiro", :da=>"Dansk", :nb=>"Norsk Bokmål", :sl=>"Slovenian", :es=>"Español", :it=>"Italiano", :de=>"Deutsch", :lv=>"Latviski", :ru=>"Русский", :sv=>"Svenska", :pl=>"Polski", :"zh-CN"=>"简体中文", :"zh-TW"=>"繁體中文", :el=>"Ελληνικά", :rs=>"Srpski", :cs=>"Česky", :sk=>"Slovenský", :ja=>"日本語", :bg=>"Български", :hu=>"Hungarian", :uk=>"Українська"}
config.locales = { en: "English", ar: "Arabic" }
# { nl: "Nederlands",
# pt: "Português",
# "pt-BR": "Português brasileiro",
# da: "Dansk",
# nb: "Norsk Bokmål",
# sl: "Slovenian",
# es: "Español",
# it: "Italiano",
# de: "Deutsch",
# lv: "Latviski",
# ru: "Русский",
# sv: "Svenska",
# pl: "Polski",
# "zh-CN": "简体中文",
# "zh-TW": "繁體中文",
# el: "Ελληνικά",
# rs: "Srpski",
# cs: "Česky",
# sk: "Slovenský",
# ja: "日本語",
# bg: "Български",
# hu: "Hungarian",
# uk: "Українська" }
end
```
4 changes: 2 additions & 2 deletions refinerycms-i18n.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")

s.required_ruby_version = '>= 2.2.9'
s.required_ruby_version = '>= 3.1'
Comment thread
parndt marked this conversation as resolved.
Outdated

s.add_dependency 'routing-filter', '~> 0.6'
s.add_dependency 'rails-i18n', '>= 5.0'
s.add_dependency 'mobility', '~> 0.8.8'
s.add_dependency 'mobility', '~> 1.2.9'

s.cert_chain = [File.expand_path("../certs/parndt.pem", __FILE__)]
if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__)
Expand Down
4 changes: 2 additions & 2 deletions spec/features/set_locale_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# encoding: utf-8
require "spec_helper"

describe "set_locale parameter", :type => :feature do
describe "set_locale parameter", type: :feature do
refinery_login

it "changes language used in backend" do
visit refinery.admin_pages_path

expect(page).to have_content("Switch to your website")

visit refinery.admin_pages_path(:set_locale => :cs)
visit refinery.admin_pages_path(set_locale: :cs)

expect(page).to have_content("Přepnout na web")
end
Expand Down
33 changes: 21 additions & 12 deletions translate-readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Translate
=========

This plugin provides a web interface for translating Rails I18n texts (requires Rails 2.2 or higher) from one locale to another. The plugin has been tested only with the simple I18n backend that ships with Rails. I18n texts are read from and written to YAML files under config/locales.
This plugin provides a web interface for translating Rails I18n texts (requires Rails 2.2 or higher) from one locale to another. The plugin has been tested only with the simple I18n backend that ships with Rails. I18n texts are read from and written to YAML files under `config/locales`.

To translate to a new locale you need to add a YAML file for that locale that contains the locale as the top key and at least one translation.
To translate to a new locale you need to add a YAML file for that locale.
A translation file has the _locale_ as the top key and at least one translation.

Please note that there are certain I18n keys that map to Array objects rather than strings and those are currently not dealt with by the translation UI. This means that Rails built in keys such as date.day_names need to be translated manually directly in the YAML file.

Expand All @@ -19,21 +20,29 @@ Rake Tasks

In addition to the web UI this plugin adds the following rake tasks:

translate:lost_in_translation
translate:merge_keys
translate:google
translate:changed
* translate:lost_in_translation
* translate:merge_keys
* translate:google
* translate:changed

The lost_in_translation task shows you any I18n keys in your code that are do not have translations in the YAML file for your default locale, i.e. config/locales/sv.yml.
### Lost in Translation
The `translate:lost_in_translation` task shows you any I18n keys in your code that are do not have translations in the YAML file for your default locale, i.e. config/locales/sv.yml.

The merge_keys task is supposed to be used in conjunction with Sven Fuch's Rails I18n TextMate bundle (http://github.com/svenfuchs/rails-i18n/tree/master). Texts and keys extracted with the TextMate bundle end up in the temporary file log/translations.yml. When you run the merge_keys rake task the keys are moved over to the corresponding I18n locale file, i.e. config/locales/sv.yml. The merge_keys task also checks for overwrites of existing keys by warning you that one of your extracted keys already exists with a different translation.
### Merge Keys
The `translate:merge_keys` task is supposed to be used in conjunction with Sven Fuch's [Rails I18n TextMate bundle](http://github.com/svenfuchs/rails-i18n/tree/master).

The google task is used for auto translating from one locale to another using Google Translate.
Texts and keys extracted with the TextMate bundle end up in a temporary file `log/translations.yml`.
When you run the `merge_keys` rake task these keys are moved to the corresponding I18n locale file, i.e. `config/locales/sv.yml`.
The `merge_keys` task also warns you if one of your extracted keys will overwrite an existing translation.

The changed rake task can show you between one YAML file to another which keys have had their texts changed.
### Translate Google
The `translate:google` task is used for auto translating from one locale to another using Google Translate.

### Translate Changed
The `translate:changed` task can show you which keys have had their texts changed between one file and another.

## Installation

Installation
=========
Obtain the source with:

./script/plugin install git://github.com/newsdesk/translate.git
Expand Down