From 21827da354a83d9cf895a7d72bcda7d7efe8802d Mon Sep 17 00:00:00 2001 From: f Date: Tue, 31 Mar 2020 17:20:34 -0300 Subject: [PATCH] =?UTF-8?q?las=20plantillas=20pueden=20informar=20el=20nom?= =?UTF-8?q?bre=20del=20tipo=20de=20art=C3=ADculo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/site.rb | 5 +++++ app/views/posts/index.haml | 2 +- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/site.rb b/app/models/site.rb index 8a89f64..058e16e 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -124,6 +124,11 @@ class Site < ApplicationRecord config.fetch('locales', I18n.available_locales.map(&:to_s)) end + # Similar a site.i18n en jekyll-locales + def i18n + data[I18n.locale.to_s] + end + # Devuelve el idioma por defecto del sitio, el primero de la lista. def default_locale locales.first diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index cded824..ee8355a 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -14,7 +14,7 @@ %h3= t('posts.new') %ul - @site.layouts.to_h.keys.each do |layout| - %li= link_to layout.to_s.humanize, + %li= link_to @site.i18n.dig('layouts', layout.to_s) || layout.to_s.humanize, new_site_post_path(@site, layout: layout) - if policy(@site).edit? diff --git a/config/locales/en.yml b/config/locales/en.yml index 06b0fd0..5402239 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -387,7 +387,7 @@ en: date: 'date' order: 'Order' content: 'Text' - new: 'New post as' + new: 'Add:' dropdown: 'Toggle dropdown' categories: 'Everything' index: 'Posts' diff --git a/config/locales/es.yml b/config/locales/es.yml index 4d310ae..816f5b0 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -397,7 +397,7 @@ es: content: 'Cuerpo del artículo' categories: 'Todos' dropdown: 'Desplegar el menú' - new: 'Crear artículo en:' + new: 'Agregar:' index: 'Artículos' edit: 'Editar' open: 'Nota: Puedes agregar más opciones a medida que las escribes y presionas Entrar'