add conditional to accesibility.rb generator preventing exceptions when row in translation files is nul
This commit is contained in:
@@ -28,11 +28,13 @@ def generate_content(page)
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>"
|
<tbody>"
|
||||||
I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.rows").each do |row|
|
I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.rows").each do |row|
|
||||||
|
if row.present?
|
||||||
content << " <tr>
|
content << " <tr>
|
||||||
<td class='text-center'>#{row[:key_column]}</td>
|
<td class='text-center'>#{row[:key_column]}</td>
|
||||||
<td>#{row[:page_column]}</td>
|
<td>#{row[:page_column]}</td>
|
||||||
</tr>"
|
</tr>"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
content << " </tbody>
|
content << " </tbody>
|
||||||
</table>
|
</table>
|
||||||
<p>#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.description")}</p>
|
<p>#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.description")}</p>
|
||||||
@@ -52,11 +54,13 @@ def generate_content(page)
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>"
|
<tbody>"
|
||||||
I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.rows").each do |row|
|
I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.rows").each do |row|
|
||||||
|
if row.present?
|
||||||
content << " <tr>
|
content << " <tr>
|
||||||
<td>#{row[:browser_column]}</td>
|
<td>#{row[:browser_column]}</td>
|
||||||
<td>#{row[:key_column]}</td>
|
<td>#{row[:key_column]}</td>
|
||||||
</tr>"
|
</tr>"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
content << " </tbody>
|
content << " </tbody>
|
||||||
</table>
|
</table>
|
||||||
<h2>#{I18n.t("pages.accessibility.textsize.title")}</h2>
|
<h2>#{I18n.t("pages.accessibility.textsize.title")}</h2>
|
||||||
@@ -74,18 +78,22 @@ def generate_content(page)
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>"
|
<tbody>"
|
||||||
I18n.t("pages.accessibility.textsize.browser_settings_table.rows").each do |row|
|
I18n.t("pages.accessibility.textsize.browser_settings_table.rows").each do |row|
|
||||||
|
if row.present?
|
||||||
content << " <tr>
|
content << " <tr>
|
||||||
<td>#{row[:browser_column]}</td>
|
<td>#{row[:browser_column]}</td>
|
||||||
<td>#{row[:action_column]}</td>
|
<td>#{row[:action_column]}</td>
|
||||||
</tr>"
|
</tr>"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
content << " </tbody>
|
content << " </tbody>
|
||||||
</table>"
|
</table>"
|
||||||
content << "<p>#{I18n.t("pages.accessibility.textsize.browser_shortcuts_table.description")}</p>
|
content << "<p>#{I18n.t("pages.accessibility.textsize.browser_shortcuts_table.description")}</p>
|
||||||
<ul>"
|
<ul>"
|
||||||
I18n.t("pages.accessibility.textsize.browser_shortcuts_table.rows").each do |row|
|
I18n.t("pages.accessibility.textsize.browser_shortcuts_table.rows").each do |row|
|
||||||
|
if row.present?
|
||||||
content << "<li><strong>#{row[:shortcut_column]}</strong> #{row[:description_column]}</li>"
|
content << "<li><strong>#{row[:shortcut_column]}</strong> #{row[:description_column]}</li>"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
content << "</ul>
|
content << "</ul>
|
||||||
<h2>#{I18n.t("pages.accessibility.compatibility.title")}</h2>
|
<h2>#{I18n.t("pages.accessibility.compatibility.title")}</h2>
|
||||||
<p>#{I18n.t("pages.accessibility.compatibility.description")}</p>"
|
<p>#{I18n.t("pages.accessibility.compatibility.description")}</p>"
|
||||||
@@ -100,7 +108,6 @@ if SiteCustomization::Page.find_by(slug: "accessibility").nil?
|
|||||||
I18n.available_locales.each do |locale|
|
I18n.available_locales.each do |locale|
|
||||||
I18n.locale = locale
|
I18n.locale = locale
|
||||||
translation = page.translations.build(locale: locale)
|
translation = page.translations.build(locale: locale)
|
||||||
# Not generating content for :fa, :id and it translations, as they are causing error in line 32
|
generate_content(translation)
|
||||||
generate_content(translation) unless locale == :fa or locale == :id or locale == :it
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user