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" name: "Polskie"
}, },
"pt-BR" => { "pt-BR" => {
name: "Brazilian Portugese", name: "Português do Brasil",
notice: "A última versão (#{$last_version}) ainda não está disponível em 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 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>." <a href='#{issues_url}'>ajudar em sua tradução</a>."
@ -154,6 +154,19 @@ helpers do
def path_to_url(path) def path_to_url(path)
Addressable::URI.join(config.site_url, path).normalize.to_s Addressable::URI.join(config.site_url, path).normalize.to_s
end 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 end
# -------------------------------------- # --------------------------------------

View File

@ -167,13 +167,16 @@ version: 1.0.0
Confusing Dates Confusing Dates
%p %p
In the U.S., people put the month first (<code>06-02-2012</code> for Regional date formats vary throughout the world and it's often
June 2nd, 2012), while many people in the rest of the world write a difficult to find a human-friendly date format that feels intuitive
robotic-looking <code>2 June 2012</code>, yet pronounce it to everyone. The advantage of dates formatted like
differently. <code>2012-06-02</code> works logically from largest to <code>2017-07-17</code> is that they follow the order of largest to
smallest, doesn't overlap in ambiguous ways with other date formats, smallest units: year, month, and day. This format also doesn't
and is an #{link_to "ISO standard", iso}. Thus, it is the overlap in ambiguous ways with other date formats, unlike some
recommended date format for changelogs. 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 %aside
Theres more. Help me collect these antipatterns by Theres more. Help me collect these antipatterns by

View File

@ -46,14 +46,10 @@
%nav.locales{ role: "navigation" } %nav.locales{ role: "navigation" }
%select %select
- $languages.each do |language| - $languages.each do |language|
- version_exists = File.exists?("source/#{language.first}/#{$last_version}")
- selected = language_code == language.first - selected = language_code == language.first
- if version_exists - if available_translation = available_translation_for(language)
%option{ selected: selected, label: "#{$last_version} #{language.last[:name]}", value: language.first } %option{ selected: selected, label: available_translation, value: language.first }
- else = available_translation
- previous_version = File.exists?("source/#{language.first}/#{$previous_version}")
- if previous_version
%option{ selected: selected, label: "#{$previous_version} #{language.last[:name]}", value: language.first }
.main{ role: "main" } .main{ role: "main" }
- if !latest_version - if !latest_version

View File

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