Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'json'
require 'date'
require 'fileutils'

def years_since(date_string)
years = if date_string =~ /^\d{4}$/
Expand Down Expand Up @@ -32,6 +33,7 @@ def icon(key)

template = File.read('index.template')
technologies = JSON.parse(File.read('technologies.json'))
languages = JSON.parse(File.read('languages.json'))
@icons = JSON.parse(File.read('icons.json'))

technology_html = technologies.map do |tech|
Expand All @@ -54,4 +56,22 @@ def icon(key)
generated_html = template.sub("TECH_GOES_HERE", technology_html)
generated_html = generated_html.sub("DROPDOWN_OPTIONS", dropdown_html)

File.write("index.html", generated_html)
lang_codes = languages.map.with_index do |language, index|

generated_html_translated = generated_html.sub("TITLE_TEXT", language['title_text'])
generated_html_translated = generated_html_translated.sub("MAIN_TEXT", language['main_text'])
generated_html_translated = generated_html_translated.sub("HOW_LONG_TEXT", language['howlong_text'])
generated_html_translated = generated_html_translated.sub("EXISTED_TEXT", language['existed_text'])
generated_html_translated = generated_html_translated.sub("FOOTER_TEXT", language['footer_text'])

path = "localized/" + language['code']
FileUtils.mkdir_p(path)

if (language['code'] == 'en')
File.write("index.html", generated_html_translated)
end

File.write(path + "/index.html", generated_html_translated)
end.join


8 changes: 4 additions & 4 deletions index.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>You want HOW MANY years experience?!</title>
<title>TITLE_TEXT</title>
</head>
<body>
<noscript>
Expand All @@ -33,19 +33,19 @@
</noscript>
<div class="App">
<header class="App-header">
<h1>How long has <input id="tech-dropdown" type="search" list="technologies" placeholder="react, vue, ember, etc." onChange={this.filterChanged} ref={this.filterInput} /> existed?
<h1>HOW_LONG_TEXT <input id="tech-dropdown" type="search" list="technologies" placeholder="react, vue, ember, etc." onChange={this.filterChanged} ref={this.filterInput} /> EXISTED_TEXT
<datalist id="technologies">DROPDOWN_OPTIONS</datalist></h1>
</header>

<main>
<p>Thinking of asking for five years of experience in a two year old technology? Think again!</p>
<p>MAIN_TEXT</p>

<div id="rows">
TECH_GOES_HERE
</div>

<div id="footer">
<p>Missing a technology? Find this repo on <a href="https://github.com/jsrn/howoldisit">GitHub</a>. Want a piece of me? Hurl abuse on <a href="https://twitter.com/zerosumjames">Twitter</a>.
<p>FOOTER_TEXT
</p>
</div>
</main>
Expand Down
Loading