traducir o editar
This commit is contained in:
parent
84a6f632af
commit
f3b6717b23
4 changed files with 40 additions and 10 deletions
|
@ -10,7 +10,7 @@ class I18nController < ApplicationController
|
|||
def edit
|
||||
@site = find_site
|
||||
@lang_from = params.fetch(:from, I18n.locale.to_s)
|
||||
@lang_to = params.fetch(:to, I18n.available_locales.sample.to_s)
|
||||
@lang_to = params.fetch(:to, @lang_from)
|
||||
@options = I18n.available_locales.map do |lang|
|
||||
[ t("i18n.#{lang.to_s}"), lang.to_s ]
|
||||
end
|
||||
|
|
|
@ -1,14 +1,27 @@
|
|||
= form_tag site_i18n_edit_path(@site), method: :get, class: 'form-inline' do
|
||||
%h1
|
||||
= t('i18n.translating.from')
|
||||
= select_tag 'from',
|
||||
options_for_select(@options, @lang_from),
|
||||
class: 'form-control'
|
||||
= t('i18n.translating.to')
|
||||
= select_tag 'to',
|
||||
options_for_select(@options, @lang_to),
|
||||
class: 'form-control'
|
||||
= submit_tag t('i18n.change'), class: 'btn btn-info', name: nil
|
||||
- if @lang_from == @lang_to
|
||||
= t('i18n.edit_same')
|
||||
= select_tag 'from',
|
||||
options_for_select(@options, @lang_from),
|
||||
class: 'form-control'
|
||||
= t('i18n.translate_into')
|
||||
= select_tag 'to',
|
||||
options_for_select(@options, @lang_to),
|
||||
class: 'form-control'
|
||||
= submit_tag t('i18n.translate'), class: 'btn btn-info', name: nil
|
||||
- else
|
||||
= t('i18n.translating.from')
|
||||
= select_tag 'from',
|
||||
options_for_select(@options, @lang_from),
|
||||
class: 'form-control'
|
||||
= t('i18n.translating.to')
|
||||
= select_tag 'to',
|
||||
options_for_select(@options, @lang_to),
|
||||
class: 'form-control'
|
||||
= submit_tag t('i18n.change'), class: 'btn btn-info', name: nil
|
||||
|
||||
= render 'layouts/help', help: t('help.i18n.index')
|
||||
|
||||
= form_tag site_i18n_path(@site), method: :post, class: 'form' do
|
||||
= hidden_field 'i18n', 'lang_to', value: @lang_to
|
||||
|
@ -16,3 +29,6 @@
|
|||
= submit_tag t('i18n.save'), class: 'btn btn-success'
|
||||
|
||||
= render 'i18n/recursive', data: @site.data.dig(@lang_from), superkeys: []
|
||||
|
||||
.form-group
|
||||
= submit_tag t('i18n.save'), class: 'btn btn-success'
|
||||
|
|
|
@ -6,6 +6,11 @@ en:
|
|||
breadcrumbs: "What you see up here are the bread crumbs for this
|
||||
site. When you enter a new section, you will see the previous ones
|
||||
and also have a path for where you\'re standing."
|
||||
i18n:
|
||||
index: "Here you can edit your site's texts that don't belong to a
|
||||
post, like its description, sections, buttons... If you change
|
||||
languages up there in the title to be the same, you can edit them.
|
||||
If they're different, you can translate from one into the other."
|
||||
sites:
|
||||
index: 'This is the list of sites you can edit.'
|
||||
edit_translations: "You can edit texts from your site other than
|
||||
|
|
|
@ -6,6 +6,12 @@ es:
|
|||
breadcrumbs: 'Lo que ves arriba son las migas de pan de este sitio.
|
||||
Cuando ingreses a una sección, podrás volver a las secciones
|
||||
anteriores y además tener una ruta de donde estás parada.'
|
||||
i18n:
|
||||
index: 'Aquí puedes editar todos los textos del sitio que no se
|
||||
corresponden con artículos, como la descripción, secciones, textos
|
||||
de botones... Si cambias los idiomas arriba para que coincidan,
|
||||
puedes editar los textos en el mismo idioma. Si los idiomas no
|
||||
coinciden, puedes traducirlos de uno a otro.'
|
||||
sites:
|
||||
index: 'Este es el listado de sitios que puedes editar.'
|
||||
edit_translations: 'Puedes editar los textos que salen en tu sitio
|
||||
|
@ -71,8 +77,11 @@ es:
|
|||
i18n:
|
||||
index: 'Traducciones'
|
||||
edit: 'Editar textos y traducciones'
|
||||
edit_same: 'Editar textos en'
|
||||
save: 'Guardar'
|
||||
translate_into: '. Traducir a'
|
||||
change: 'Cambiar'
|
||||
translate: 'Traducir'
|
||||
translating:
|
||||
from: 'Traduciendo desde'
|
||||
to: 'a'
|
||||
|
|
Loading…
Reference in a new issue