tp-language_list 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +15 -0
- data/Gemfile +4 -0
- data/README.md +36 -0
- data/Rakefile +19 -0
- data/data/dump +0 -0
- data/data/languages.yml +61658 -0
- data/language_list.gemspec +23 -0
- data/lib/language_list/version.rb +3 -0
- data/lib/language_list.rb +107 -0
- data/test/benchmark.rb +9 -0
- data/test/benchmark_lookup.rb +20 -0
- data/test/language_list_test.rb +257 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1d7f63a9f374e71c465a61ecc10eb8b9df24d552c0a2d5e000f1d24aa4d467e5
|
4
|
+
data.tar.gz: fc47e55f13e6792ef95f5e295af2c7580f6103b934601ceba4ce1279d824a6c7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f29374a6ad5116cac2027f0335ebc2602a6c8315aff118f0931fd8a3d5935333b2ecb7c1f811bd3ddf40c395f4ec14e45e373319fcc7457f9283f3956fd4ebfb
|
7
|
+
data.tar.gz: b86d013727e032f00496d2c0e2d1b6d63bc38e99c0fdf22983bbaca6e485d2c28457d6345f4a69c7256131cd7e332fcb97f40bba4a78f9a2a162a4dc12b6bc5a
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Language List
|
2
|
+
A list of languages based upon ISO-639-1 and ISO-639-3 with functions to retrieve only common languages.
|
3
|
+
|
4
|
+
[](https://travis-ci.org/scsmith/language_list)
|
5
|
+
|
6
|
+
## Examples
|
7
|
+
# Get an array of LanguageList::LanguageInfo classes
|
8
|
+
all_languages = LanguageList::ALL_LANGUAGES
|
9
|
+
common_languages = LanguageList::COMMON_LANGUAGES
|
10
|
+
|
11
|
+
# Finding a language based on its ISO-639-1 or ISO-639-3 code or
|
12
|
+
# name
|
13
|
+
german = LanguageList::LanguageInfo.find('German')
|
14
|
+
english = LanguageList::LanguageInfo.find('en')
|
15
|
+
english.name.inspect #=> "English"
|
16
|
+
english.iso_639_1.inspect #=> "en"
|
17
|
+
english.iso_639_3.inspect #=> "eng"
|
18
|
+
english.common? #=> true
|
19
|
+
|
20
|
+
## Testing
|
21
|
+
|
22
|
+
rake
|
23
|
+
|
24
|
+
## Upgrading
|
25
|
+
|
26
|
+
### 1.1 to 1.2
|
27
|
+
|
28
|
+
* Version 1.2 freezes all of the constants once they're loaded.
|
29
|
+
|
30
|
+
## Thanks
|
31
|
+
Thanks goes to Steve Hardie for his work on creating a list of common languages (http://stevehardie.com/2009/10/list-of-common-languages/).
|
32
|
+
|
33
|
+
## License
|
34
|
+
I don't actually know the license for this project. The project contains countries from the ISO language list although they were not obtained from the ISO website. The country list has been adapted and placed in data/languages.yml, so that it can be replaced if required.
|
35
|
+
|
36
|
+
All of the code (everything except data/languages.yml) in this project is released under an MIT license.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'language_list'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
require 'rake/testtask'
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.test_files = FileList['test/language_list_test.rb']
|
8
|
+
t.verbose = true
|
9
|
+
end
|
10
|
+
|
11
|
+
task :dump do
|
12
|
+
path = File.expand_path(File.join('..', 'data', 'languages.yml'), __FILE__)
|
13
|
+
data = YAML.load_file(path)
|
14
|
+
entries = data.map { |entry| LanguageList::LanguageInfo.new(entry) }
|
15
|
+
output_path = File.expand_path(File.join('..', 'data', 'dump'), __FILE__)
|
16
|
+
File.write(output_path, Marshal.dump(entries))
|
17
|
+
end
|
18
|
+
|
19
|
+
task :default => :test
|
data/data/dump
ADDED
Binary file
|