Skip to content

Commit

Permalink
Included optional location for locale definitions
Browse files Browse the repository at this point in the history
- README is updated
- Version is updated
  • Loading branch information
drorata committed Jan 23, 2018
1 parent 2740f81 commit e3228f4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -87,6 +87,12 @@ Support for ``en``, ``ge``, ``es``, ``fi`` and ``pt`` right now. Pull requests f
$ json_resume convert --locale=es prateek_cv.json
```

It is also possible to define a custom location for locale definitions.
Pass the option `--locale_dir=path/to/defs`.
In this location there should be the definitions available.
The default one is `en.yml`, others may be provided as well.
This is useful if you want to define new headings.

## Markup Language

JSON is parsed as per the `markdown` standards. This implies all this works-
Expand Down
9 changes: 8 additions & 1 deletion bin/json_resume
Expand Up @@ -26,6 +26,7 @@ class JsonResumeCLI < Thor
desc 'convert /path/to/json/file', 'converts the json to pretty resume format'
option :out, default: 'html', banner: 'output_type', desc: 'html|html_pdf|tex|tex_pdf|md'
option :template, banner: 'template_path', desc: 'path to customized template (optional)'
option :locale_dir, desc: 'path to locale definitions (optional)'
option :locale, default: 'en', banner: 'locale', desc: 'en|ge|es|pt|zh_cn'
option :theme, default: 'default', banner: 'theme', desc: 'default|classic'
option :dest_dir, default: 'current', banner: 'dest_dir', desc: 'location of dest. dir (optional)'
Expand Down Expand Up @@ -185,7 +186,13 @@ class JsonResumeCLI < Thor
end

def assign_i18n(locale)
I18n.load_path = Dir["#{@@orig_locn}/../locale/*.yml"]
if options[:locale_dir]
locale_dir = "#{File.expand_path(options[:locale_dir])}/*.yml"
else
locale_dir = "#{@@orig_locn}/../locale/*.yml"
end
puts "Using #{locale_dir} for locale files"
I18n.load_path = Dir[locale_dir]
I18n.enforce_available_locales = true
I18n.locale = locale.to_sym
end
Expand Down
2 changes: 1 addition & 1 deletion lib/json_resume/version.rb
@@ -1,3 +1,3 @@
module JsonResume
VERSION = '1.0.5'
VERSION = '1.0.6'
end
8 changes: 1 addition & 7 deletions locale/en.yml
Expand Up @@ -14,19 +14,15 @@ en:
# "GitHub Projects"
github_projects: "GitHub Projects"
# GPA
gpa: "Grade"
gpa: "GPA"
# "Graduate Courses Taken"
grad_courses: "Graduate Courses Taken"
# "Starting Year"
starting_year: "Starting Year"
# "Graduation Year"
graduation_year: "Graduation Year"
# "Institution"
institution: "Institution"
# "issued on"
issuance: "issued on"
# "Languages"
langs: "Languages"
# "Major"
major: "Major"
# "Memberships"
Expand All @@ -41,8 +37,6 @@ en:
research_experience: "Research Experience"
# "Technical Skills"
skills: "Technical Skills"
# "Some Highlights"
job_highlights: "Some Highlights"
# "Qualifications summary"
summary: "Qualifications summary"
# "Technologies got to work on"
Expand Down

0 comments on commit e3228f4

Please sign in to comment.