diff --git a/config.rb b/config.rb
index d217b5c..b64fe7d 100644
--- a/config.rb
+++ b/config.rb
@@ -49,7 +49,7 @@ $languages = {
name: "Polskie"
},
"pt-BR" => {
- name: "Brazilian Portugese",
+ name: "Português do Brasil",
notice: "A última versão (#{$last_version}) ainda não está disponível em
Português mas nesse momento você pode lê-la em inglês e
ajudar em sua tradução."
@@ -154,6 +154,19 @@ helpers do
def path_to_url(path)
Addressable::URI.join(config.site_url, path).normalize.to_s
end
+
+ def available_translation_for(language)
+ language_name = language.last[:name]
+ language_path = "source/#{language.first}"
+
+ if File.exists?("#{language_path}/#{$last_version}")
+ "#{$last_version} #{language_name}"
+ elsif File.exists?("#{language_path}/#{$previous_version}")
+ "#{$previous_version} #{language_name}"
+ else
+ nil
+ end
+ end
end
# --------------------------------------
diff --git a/source/en/1.0.0/index.html.haml b/source/en/1.0.0/index.html.haml
index 32c7291..3632429 100644
--- a/source/en/1.0.0/index.html.haml
+++ b/source/en/1.0.0/index.html.haml
@@ -167,13 +167,16 @@ version: 1.0.0
Confusing Dates
%p
- In the U.S., people put the month first (06-02-2012
for
- June 2nd, 2012), while many people in the rest of the world write a
- robotic-looking 2 June 2012
, yet pronounce it
- differently. 2012-06-02
works logically from largest to
- smallest, doesn't overlap in ambiguous ways with other date formats,
- and is an #{link_to "ISO standard", iso}. Thus, it is the
- recommended date format for changelogs.
+ Regional date formats vary throughout the world and it's often
+ difficult to find a human-friendly date format that feels intuitive
+ to everyone. The advantage of dates formatted like
+ 2017-07-17
is that they follow the order of largest to
+ smallest units: year, month, and day. This format also doesn't
+ overlap in ambiguous ways with other date formats, unlike some
+ regional formats that switch the position of month and day numbers.
+ These reasons, and the fact this date format is an
+ #{link_to "ISO standard", iso} are why it is the recommended date
+ format for changelog entries.
%aside
There’s more. Help me collect these antipatterns by
diff --git a/source/layouts/layout.html.haml b/source/layouts/layout.html.haml
index 91b2244..f57b928 100644
--- a/source/layouts/layout.html.haml
+++ b/source/layouts/layout.html.haml
@@ -46,14 +46,10 @@
%nav.locales{ role: "navigation" }
%select
- $languages.each do |language|
- - version_exists = File.exists?("source/#{language.first}/#{$last_version}")
- selected = language_code == language.first
- - if version_exists
- %option{ selected: selected, label: "#{$last_version} #{language.last[:name]}", value: language.first }
- - else
- - previous_version = File.exists?("source/#{language.first}/#{$previous_version}")
- - if previous_version
- %option{ selected: selected, label: "#{$previous_version} #{language.last[:name]}", value: language.first }
+ - if available_translation = available_translation_for(language)
+ %option{ selected: selected, label: available_translation, value: language.first }
+ = available_translation
.main{ role: "main" }
- if !latest_version
diff --git a/source/ru/1.0.0/index.html.haml b/source/ru/1.0.0/index.html.haml
index 1b6b0fe..cad609a 100644
--- a/source/ru/1.0.0/index.html.haml
+++ b/source/ru/1.0.0/index.html.haml
@@ -299,5 +299,5 @@ version: 1.0.0
%h3 Обсуждения
%p
Я приходил в #{link_to "подкаст The Changelog", thechangelog},
- чтобы поговорить о том, почему мейнтейнеры и контрьбьюторы долны вести логи изменений,
+ чтобы поговорить о том, почему мейнтейнеры и контрьбьюторы должны вести логи изменений,
а также о моей мотивации к созданию этого проекта.