Merge pull request #2 from olivierlacan/master

Merge
This commit is contained in:
Michele Castoldi 2017-07-20 08:44:14 +02:00 committed by GitHub
commit bbf604eb06
4 changed files with 28 additions and 16 deletions

View File

@ -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 <a href='/en/'>-la em inglês</a> e
<a href='#{issues_url}'>ajudar em sua tradução</a>."
@ -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
# --------------------------------------

View File

@ -167,13 +167,16 @@ version: 1.0.0
Confusing Dates
%p
In the U.S., people put the month first (<code>06-02-2012</code> for
June 2nd, 2012), while many people in the rest of the world write a
robotic-looking <code>2 June 2012</code>, yet pronounce it
differently. <code>2012-06-02</code> 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
<code>2017-07-17</code> 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
Theres more. Help me collect these antipatterns by

View File

@ -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

View File

@ -299,5 +299,5 @@ version: 1.0.0
%h3 Обсуждения
%p
Я приходил в #{link_to "подкаст The Changelog", thechangelog},
чтобы поговорить о том, почему мейнтейнеры и контрьбьюторы долны вести логи изменений,
чтобы поговорить о том, почему мейнтейнеры и контрьбьюторы должны вести логи изменений,
а также о моей мотивации к созданию этого проекта.