Skip to content

Commit

Permalink
set encoding to utf-8 on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Aug 26, 2009
1 parent d749b58 commit 9be3d4a
Show file tree
Hide file tree
Showing 53 changed files with 106 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/i18n.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

# Authors:: Matt Aimonetti (http://railsontherun.com/),
# Sven Fuchs (http://www.artweb-design.de),
# Joshua Harvey (http://www.workingwithrails.com/person/759-joshua-harvey),
Expand Down
11 changes: 7 additions & 4 deletions lib/i18n/backend/base.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'yaml'

module I18n
Expand Down Expand Up @@ -102,11 +104,12 @@ def lookup(locale, key, scope = [], separator = nil)
return unless key
init_translations unless initialized?
keys = I18n.send(:normalize_translation_keys, locale, key, scope, separator)
keys.inject(translations) do |result, k|
if (x = result[k.to_sym]).nil?
return nil
keys.inject(translations) do |result, key|
key = key.to_sym
if result.respond_to?(:has_key?) and result.has_key?(key)
result[key]
else
x
return nil
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/backend/cache.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

# This module allows you to easily cache all responses from the backend - thus
# speeding up the I18n aspects of your application quite a bit.
#
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/backend/chain.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module I18n
module Backend
# Backend that chains multiple other backends and checks each of them when
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/backend/fallbacks.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'i18n/locale/fallbacks'

# I18n locale fallbacks are useful when you want your application to use
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/backend/gettext.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'i18n/gettext'
require File.expand_path(File.dirname(__FILE__) + '/../../../vendor/po_parser.rb')

Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/backend/pluralization.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

# I18n locale fallbacks are useful when you want your application to use
# translations from other locales when translations for the current locale are
# missing. E.g. you might want to use :en translations when translations in
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/backend/simple.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'i18n/backend/base'

# Stub class for the Simple backend. The actual implementation is provided by
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/exceptions.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

class KeyError < IndexError
def initialize(message = nil)
super(message || "key not found")
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/gettext.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module I18n
module Gettext
PLURAL_SEPARATOR = "\001"
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/helpers/gettext.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module I18n
module Helpers
# Implements classical Gettext style accessors. To use this include the
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/locale/fallbacks.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'i18n/locale/tag'

# Locale Fallbacks
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/locale/tag.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'i18n/locale/tag/simple'
require 'i18n/locale/tag/rfc4646'

Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/locale/tag/parents.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module I18n
module Locale
module Tag
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/locale/tag/rfc4646.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

# RFC 4646/47 compliant Locale tag implementation that parses locale tags to
# subtags such as language, script, region, variant etc.
#
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/locale/tag/simple.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require 'i18n/locale/tag/parents'

# Simple Locale tag implementation that computes subtags by simply splitting
Expand Down
2 changes: 2 additions & 0 deletions lib/i18n/string.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

=begin
heavily based on Masao Mutoh's gettext String interpolation extension
http://github.com/mutoh/gettext/blob/f6566738b981fe0952548c421042ad1e0cdfb31e/lib/gettext/core_ext/string.rb
Expand Down
2 changes: 2 additions & 0 deletions test/all.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

Dir[File.dirname(__FILE__) + '/**/*_test.rb'].sort.each do |file|
require file
end
2 changes: 2 additions & 0 deletions test/api/basics.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/interpolation.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/lambda.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/link.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/localization/date.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/localization/date_time.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/localization/lambda.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/localization/time.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/pluralization.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/api/translation.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Api
Expand Down
2 changes: 2 additions & 0 deletions test/backend/cache/cache_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'i18n/backend/cache'
require 'activesupport'
Expand Down
2 changes: 2 additions & 0 deletions test/backend/chain/api_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'i18n/backend/chain'

Expand Down
2 changes: 2 additions & 0 deletions test/backend/chain/chain_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'i18n/backend/chain'

Expand Down
2 changes: 2 additions & 0 deletions test/backend/fallbacks/api_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'i18n/backend/fallbacks'

Expand Down
2 changes: 2 additions & 0 deletions test/backend/fallbacks/fallbacks_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'i18n/backend/fallbacks'

Expand Down
2 changes: 2 additions & 0 deletions test/backend/pluralization/api_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'i18n/backend/pluralization'

Expand Down
2 changes: 2 additions & 0 deletions test/backend/pluralization/pluralization_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'i18n/backend/pluralization'

Expand Down
2 changes: 2 additions & 0 deletions test/backend/simple/all.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

Dir[File.dirname(__FILE__) + '/*_test.rb'].each do |file|
require file
end
1 change: 1 addition & 0 deletions test/backend/simple/api_test.rb
@@ -1,4 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')

class I18nSimpleBackendApiBasicsTest < Test::Unit::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/backend/simple/lookup_test.rb
@@ -1,4 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')

class I18nSimpleBackendLookupTest < Test::Unit::TestCase
Expand Down
2 changes: 2 additions & 0 deletions test/backend/simple/setup.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

module Tests
module Backend
module Simple
Expand Down
1 change: 1 addition & 0 deletions test/backend/simple/translations_test.rb
@@ -1,4 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')

class I18nSimpleBackendLoadTranslationsTest < Test::Unit::TestCase
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/locales/en.rb
@@ -1 +1,3 @@
# encoding: utf-8

{ :en => { :fuh => { :bah => "bas" } } }
2 changes: 2 additions & 0 deletions test/fixtures/locales/plurals.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

{
:af => { :i18n => { :pluralize => lambda { |n| n == 1 ? :one : :other } } },
:am => { :i18n => { :pluralize => lambda { |n| (0..1).include?(n) ? :one : :other } } },
Expand Down
2 changes: 2 additions & 0 deletions test/gettext/api_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
require 'i18n/backend/gettext'
require 'i18n/helpers/gettext'
Expand Down
2 changes: 2 additions & 0 deletions test/gettext/backend_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
require 'i18n/backend/gettext'
require 'i18n/helpers/gettext'
Expand Down
2 changes: 2 additions & 0 deletions test/i18n_exceptions_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/test_helper')

class I18nExceptionsTest < Test::Unit::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/i18n_load_path_test.rb
@@ -1,4 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/test_helper')

class I18nLoadPathTest < Test::Unit::TestCase
Expand Down
2 changes: 2 additions & 0 deletions test/i18n_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/test_helper')

class I18nTest < Test::Unit::TestCase
Expand Down
2 changes: 2 additions & 0 deletions test/locale/fallbacks_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.dirname(__FILE__) + '/../test_helper.rb'
require 'i18n/locale/fallbacks'
require 'i18n/locale/tag'
Expand Down
2 changes: 2 additions & 0 deletions test/locale/tag/rfc4646_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.dirname(__FILE__) + '/../../test_helper.rb'
require 'i18n/locale/tag'
require 'i18n/locale/tag/rfc4646'
Expand Down
2 changes: 2 additions & 0 deletions test/locale/tag/simple_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.dirname(__FILE__) + '/../../test_helper.rb'
require 'i18n/locale/tag'
require 'i18n/locale/tag/simple'
Expand Down
2 changes: 2 additions & 0 deletions test/string_test.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/test_helper')

# thanks to Masao's String extensions these should work the same in
Expand Down
1 change: 1 addition & 0 deletions test/test_helper.rb
@@ -1,4 +1,5 @@
# encoding: utf-8

$:.unshift "lib"

require 'rubygems'
Expand Down
2 changes: 2 additions & 0 deletions test/with_options.rb
@@ -1,3 +1,5 @@
# encoding: utf-8

# this is only here so we can test I18n works nicely with ActiveSupports
# with_options. Maybe we can just remove it?

Expand Down

0 comments on commit 9be3d4a

Please sign in to comment.