Skip to content

Commit

Permalink
Bump to 0.8.1
Browse files Browse the repository at this point in the history
* The default config file now excludes `app/assets/images` and
  `app/assets/fonts`. Add `*.otf` to ignored extensions.

* If an error message occurs when scanning, the error message now
  includes the filename: #141
  • Loading branch information
glebm committed Apr 2, 2015
1 parent bb5392b commit a4fe3c9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 75 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.8.1

* The default config file now excludes `app/assets/images` and app/assets/fonts`. Add `*.otf` to ignored extensions.
* If an error message occurs when scanning, the error message now includes the filename [#141](https://github.com/glebm/i18n-tasks/issues/141).

## 0.8.0

* Parse command line arguments with `optparse`. Remove dependency on Slop.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ Thus addressing the two main problems of [i18n gem][i18n-gem] design:

i18n-tasks can be used with any project using the ruby [i18n gem][i18n-gem] (default in Rails).

Add it to the Gemfile:
Add i18n-tasks to the Gemfile:

```ruby
gem 'i18n-tasks', '~> 0.8.0'
gem 'i18n-tasks', '~> 0.8.1'
```

Copy default [configuration file](#configuration) (optional):
Copy the default [configuration file](#configuration):

```console
$ cp $(i18n-tasks gem-path)/templates/config/i18n-tasks.yml config/
Expand Down
67 changes: 0 additions & 67 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,19 @@
# You can find the default config here: https://github.com/glebm/i18n-tasks/blob/master/templates/config/i18n-tasks.yml

base_locale: en
## i18n-tasks detects locales automatically from the existing locale files
## uncomment to set locales explicitly
# locales: [en, es, fr]

## i18n-tasks report locale, default: en, available: en, ru
internal_locale: en

# Read and write locale data
data:
## by default, translation data are read from the file system, or you can provide a custom data adapter
# adapter: I18n::Tasks::Data::FileSystem

# Locale files to read from
read:
- config/locales/%{locale}.yml
# - config/locales/*.%{locale}.yml
# - config/locales/**/*.%{locale}.yml

# key => file routes, matched top to bottom
write:
## E.g., write devise and simple form keys to their respective files
# - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
# Catch-all
- config/locales/%{locale}.yml
# `i18n-tasks normalize -p` will force move the keys according to these rules

# YAML / JSON serializer options, passed to load / dump / parse / serialize
yaml:
write:
## do not wrap lines at 80 characters (override default)
line_width: 96
json:
write:
# pretty print JSON
indent: ' '
space: ' '
object_nl: "\n"
array_nl: "\n"

# Find translate calls
search:
## Default scanner finds t() and I18n.t() calls
# scanner: I18n::Tasks::Scanners::PatternWithScopeScanner

## Paths to search in, passed to File.find
paths:
- lib/

## Root for resolving relative keys (default)
# relative_roots:
# - app/views

## File.fnmatch patterns to exclude from search (default)
# exclude: ["*.jpg", "*.png", "*.gif", "*.svg", "*.ico", "*.eot", "*.ttf", "*.woff", "*.pdf"]

## Or, File.fnmatch patterns to include
# include: ["*.rb", "*.html.slim"]

## Google Translate
# translation:
# # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
# api_key: "AbC-dEf5"

## Consider these keys not missing
# ignore_missing:
# - pagination.views.*

## Consider these keys used
# ignore_unused:
# - 'simple_form.{yes,no}'
# - 'simple_form.{placeholders,hints,labels}.*'
# - 'simple_form.{error_notification,required}.:'

## Exclude these keys from `i18n-tasks eq-base' report
# ignore_eq_base:
# all:
# - common.ok
# fr,es:
# - common.brand

## Exclude these keys from all of the reports
# ignore:
# - kaminari.*
2 changes: 1 addition & 1 deletion lib/i18n/tasks/scanners/base_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BaseScanner

attr_reader :config, :key_filter, :ignore_lines_res

ALWAYS_EXCLUDE = %w(*.jpg *.png *.gif *.svg *.ico *.eot *.ttf *.woff *.woff2 *.pdf
ALWAYS_EXCLUDE = %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf
*.css *.sass *.scss *.less *.yml *.json)

def initialize(config = {})
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/tasks/scanners/pattern_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def scan_file(path, opts = {})
keys << [key, data: location]
end
keys
rescue Exception => e
raise ::I18n::Tasks::CommandError.new("Error scanning #{path}: #{e.message}")
end

def default_pattern
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/tasks/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8
module I18n
module Tasks
VERSION = '0.8.0'
VERSION = '0.8.1'
end
end
7 changes: 4 additions & 3 deletions templates/config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ data:

## Pretty-print JSON:
# json:
#
# write:
# indent: ' '
# space: ' '
Expand All @@ -61,8 +60,10 @@ search:
# - app/presenters

## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
# exclude: []
## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
exclude:
- app/assets/images
- app/assets/fonts

## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
Expand Down

0 comments on commit a4fe3c9

Please sign in to comment.