5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 03:36:21 +00:00

traducir o editar

This commit is contained in:
f 2018-02-26 17:32:33 -03:00
parent 84a6f632af
commit f3b6717b23
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
4 changed files with 40 additions and 10 deletions

View file

@ -10,7 +10,7 @@ class I18nController < ApplicationController
def edit def edit
@site = find_site @site = find_site
@lang_from = params.fetch(:from, I18n.locale.to_s) @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| @options = I18n.available_locales.map do |lang|
[ t("i18n.#{lang.to_s}"), lang.to_s ] [ t("i18n.#{lang.to_s}"), lang.to_s ]
end end

View file

@ -1,5 +1,16 @@
= form_tag site_i18n_edit_path(@site), method: :get, class: 'form-inline' do = form_tag site_i18n_edit_path(@site), method: :get, class: 'form-inline' do
%h1 %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') = t('i18n.translating.from')
= select_tag 'from', = select_tag 'from',
options_for_select(@options, @lang_from), options_for_select(@options, @lang_from),
@ -10,9 +21,14 @@
class: 'form-control' class: 'form-control'
= submit_tag t('i18n.change'), class: 'btn btn-info', name: nil = 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 = form_tag site_i18n_path(@site), method: :post, class: 'form' do
= hidden_field 'i18n', 'lang_to', value: @lang_to = hidden_field 'i18n', 'lang_to', value: @lang_to
.form-group .form-group
= submit_tag t('i18n.save'), class: 'btn btn-success' = submit_tag t('i18n.save'), class: 'btn btn-success'
= render 'i18n/recursive', data: @site.data.dig(@lang_from), superkeys: [] = render 'i18n/recursive', data: @site.data.dig(@lang_from), superkeys: []
.form-group
= submit_tag t('i18n.save'), class: 'btn btn-success'

View file

@ -6,6 +6,11 @@ en:
breadcrumbs: "What you see up here are the bread crumbs for this 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 site. When you enter a new section, you will see the previous ones
and also have a path for where you\'re standing." 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: sites:
index: 'This is the list of sites you can edit.' index: 'This is the list of sites you can edit.'
edit_translations: "You can edit texts from your site other than edit_translations: "You can edit texts from your site other than

View file

@ -6,6 +6,12 @@ es:
breadcrumbs: 'Lo que ves arriba son las migas de pan de este sitio. 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 Cuando ingreses a una sección, podrás volver a las secciones
anteriores y además tener una ruta de donde estás parada.' 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: sites:
index: 'Este es el listado de sitios que puedes editar.' index: 'Este es el listado de sitios que puedes editar.'
edit_translations: 'Puedes editar los textos que salen en tu sitio edit_translations: 'Puedes editar los textos que salen en tu sitio
@ -71,8 +77,11 @@ es:
i18n: i18n:
index: 'Traducciones' index: 'Traducciones'
edit: 'Editar textos y traducciones' edit: 'Editar textos y traducciones'
edit_same: 'Editar textos en'
save: 'Guardar' save: 'Guardar'
translate_into: '. Traducir a'
change: 'Cambiar' change: 'Cambiar'
translate: 'Traducir'
translating: translating:
from: 'Traduciendo desde' from: 'Traduciendo desde'
to: 'a' to: 'a'