interfaz de traduccion

This commit is contained in:
f 2018-02-26 18:42:02 -03:00
parent f3b6717b23
commit 461808fa54
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
6 changed files with 118 additions and 37 deletions

View file

@ -1,34 +1,55 @@
= form_tag site_i18n_edit_path(@site), method: :get, class: 'form-inline' do
%h1
- 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
.row
.col
= form_tag site_i18n_edit_path(@site), method: :get, class: 'form-inline' do
%h1
- 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')
= 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
.form-group
= submit_tag t('i18n.save'), class: 'btn btn-success'
= render 'i18n/recursive', data: @site.data.dig(@lang_from), superkeys: []
.row
.col
%ul.list-group
- @site.data.dig(@lang_from).each_pair do |section, content|
%li.list-group-item.align-items-center.justify-content-between.d-flex
%a{href: "##{section}",
title: t('help.i18n.toc'),
data: { turbolinks: 'false', toggle: 'tooltip' }}= t("help.i18n.#{section}")
-# %span.badge.badge-secondary.badge-pill{data: { toggle: 'tooltip' },
title: t('help.i18n.count') }
- if content.is_a? String
= 1
- elsif content.is_a? Array
= content.count
- elsif content.is_a? Hash
= content.map(&:count).inject(&:+)
.col
.form-group
= submit_tag t('i18n.save'), class: 'btn btn-success'
= form_tag site_i18n_path(@site), method: :post, class: 'form' do
= hidden_field 'i18n', 'lang_to', value: @lang_to
.form-group
= 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'

View file

@ -1,8 +1,14 @@
- previous_key ||= ''
- data.each_pair do |key, value|
- keys = [superkeys, key].flatten
- unless keys.first == previous_key
%h2{id: keys.first}
= t("help.i18n.#{keys.first}")
- if value.is_a? String
= render 'i18n/text_field', keys: keys, value: value
- elsif value.is_a? Hash
= render 'i18n/recursive', data: value, superkeys: keys
= render 'i18n/recursive', data: value, superkeys: keys,
previous_key: keys.first
- elsif value.is_a? Array
= render 'i18n/recursive_array', data: value, superkeys: keys
= render 'i18n/recursive_array', data: value, superkeys: keys,
previous_key: keys.first

View file

@ -1,8 +1,14 @@
- previous_key ||= ''
- data.each_with_index do |value, i|
- keys = [superkeys, i].flatten
- unless keys.first == previous_key
%h2{id: keys.first}
= t("help.i18n.#{keys.first}")
- if value.is_a? String
= render 'i18n/text_field', keys: keys, value: value
- elsif value.is_a? Hash
= render 'i18n/recursive', data: value, superkeys: keys
= render 'i18n/recursive', data: value, superkeys: keys,
previous_key: keys.first
- elsif value.is_a? Array
= render 'i18n/recursive_array', data: value, superkeys: keys
= render 'i18n/recursive_array', data: value, superkeys: keys,
previous_key: keys.first

View file

@ -6,6 +6,4 @@
t('i18n.index'),
t('i18n.edit')]
.row
.col
= render 'i18n/form'
= render 'i18n/form'

View file

@ -11,6 +11,31 @@ en:
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."
count: 'This is the amount of texts.'
toc: 'Jump to this section'
meta: 'Metadata'
navegacion: 'Navigation'
inicio: 'Home'
volver: 'Back'
entrar: 'Enter'
cerrar: 'Close'
anchor: 'Internal links'
nav: 'Menu'
nav-lang: 'Language menu'
modulos: 'Modules'
header: 'Header'
sobre: 'About'
metodologia: 'Methodology'
planeando_recursos: 'Planning resources'
rutas: 'Agendas'
complementarios: 'Materials'
recursos: 'Resources'
contacta: 'Contact us'
agradecimientos: 'Acknowledgments'
sesion: 'Sessions'
sesiones: 'Sessions'
anexo: 'Appendix'
simple: 'Simple'
sites:
index: 'This is the list of sites you can edit.'
edit_translations: "You can edit texts from your site other than

View file

@ -12,6 +12,31 @@ es:
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.'
count: 'Esta es la cantidad de textos.'
toc: 'Saltar hasta esta sección'
meta: 'Metadata'
navegacion: 'Navegación'
inicio: 'Inicio'
volver: 'Volver'
entrar: 'Entrar'
cerrar: 'Cerrar'
anchor: 'Links internos'
nav: 'Menú'
nav-lang: 'Menú de idiomas'
modulos: 'Módulos'
header: 'Portada'
sobre: 'Acerca'
metodologia: 'Metodología'
planeando_recursos: 'Planeando recursos'
rutas: 'Rutas'
complementarios: 'Materiales complementarios'
recursos: 'Recursos'
contacta: 'Contacta'
agradecimientos: 'Agradecimientos'
sesion: 'Sesiones'
sesiones: 'Sesiones'
anexo: 'Anexo'
simple: 'Simple'
sites:
index: 'Este es el listado de sitios que puedes editar.'
edit_translations: 'Puedes editar los textos que salen en tu sitio