as3gettext-oneup 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/ChangeLog +4 -0
- data/Gemfile +4 -0
- data/README.rdoc +25 -7
- data/VERSION +1 -1
- data/lib/as3gettext/command.rb +13 -3
- data/lib/as3gettext/generate_xml.rb +2 -1
- data/test/helper.rb +1 -1
- data/test/test_as3gettext.rb +7 -0
- data/test/works/.gitignore +1 -0
- metadata +6 -4
- data/lib/as3gettext.rb +0 -4
data/.gitignore
ADDED
data/ChangeLog
CHANGED
data/Gemfile
ADDED
data/README.rdoc
CHANGED
@@ -1,26 +1,44 @@
|
|
1
1
|
|
2
2
|
= as3gettext-oneup
|
3
3
|
|
4
|
-
This is forked from http://coderepos.org/share/browser/lang/ruby/as3gettext/trunk
|
4
|
+
This is forked from http://coderepos.org/share/browser/lang/ruby/as3gettext/trunk
|
5
5
|
|
6
6
|
== Description
|
7
7
|
|
8
|
+
gettext for ActionScript3
|
9
|
+
|
8
10
|
|
9
11
|
== Installation
|
10
12
|
|
11
|
-
===
|
13
|
+
=== Gem Installation
|
12
14
|
|
13
|
-
|
15
|
+
% gem install as3gettext-oneup
|
14
16
|
|
15
|
-
=== Gem Installation
|
16
17
|
|
17
|
-
|
18
|
+
== Usage
|
18
19
|
|
20
|
+
% as3gettext -h
|
21
|
+
$ as3gettext src/HelloWrold.as src/**/*.mxml -o template.pot
|
22
|
+
$ as3gettext i18n/**.po -x -o langs.xml
|
23
|
+
$ as3gettext -g path/to/your/as3/src
|
24
|
+
-h, --help show this message
|
25
|
+
-x export XML
|
26
|
+
-o=VAL output file
|
27
|
+
-g=VAL generate as3 library
|
19
28
|
|
20
|
-
== Features/Problems
|
21
29
|
|
30
|
+
Generating gettext as3 library to your as3 src directory
|
31
|
+
% as3gettext -g path/to/your/as3/src
|
22
32
|
|
23
|
-
|
33
|
+
in your as code:
|
34
|
+
// initialize
|
35
|
+
var xml_string:String = load(langs.xml); // load langs.xml
|
36
|
+
com.rails2u.gettext.GetText.initLangFile(new XML(xml_string));
|
37
|
+
|
38
|
+
// use _() function
|
39
|
+
trace(_("foo")) //=> "bar"
|
40
|
+
|
41
|
+
== Features/Problems
|
24
42
|
|
25
43
|
|
26
44
|
== Copyright
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/as3gettext/command.rb
CHANGED
@@ -3,6 +3,7 @@ require 'gettext'
|
|
3
3
|
require 'gettext/tools/rgettext'
|
4
4
|
require 'as3gettext/as3_parser'
|
5
5
|
require 'as3gettext/generate_xml'
|
6
|
+
require 'fileutils'
|
6
7
|
|
7
8
|
module As3gettext
|
8
9
|
class Command
|
@@ -35,18 +36,27 @@ module As3gettext
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
39
|
+
def as3lib
|
40
|
+
Dir.glob(File.join(File.dirname(__FILE__), '..', '..', 'as3lib', '*')).each do |src|
|
41
|
+
FileUtils.cp_r(src, File.join(config[:as3lib_dir], ''))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
38
45
|
def parse(argv)
|
39
46
|
op = OptionParser.new
|
40
47
|
op.banner = <<-EOF.gsub(/^\s+/, '')
|
41
|
-
Usage:
|
48
|
+
Usage:
|
42
49
|
$ as3gettext src/HelloWrold.as src/**/*.mxml -o template.pot
|
43
|
-
$ as3gettext i18n/**.po -x -o langs.xml
|
50
|
+
$ as3gettext i18n/**.po -x -o langs.xml
|
51
|
+
$ as3gettext -g path/to/your/as3/src
|
44
52
|
EOF
|
45
53
|
op.on('-h', '--help', 'show this message') { puts op; Kernel::exit 1 }
|
46
54
|
op.on('-x', 'export XML') { config[:mode] = :xml }
|
47
55
|
op.on('-o=VAL', 'output file') {|v| config[:output] = v }
|
56
|
+
op.on('-g=VAL', 'generate as3 library') {|v| config[:mode] = :as3lib; config[:as3lib_dir] = v }
|
57
|
+
op.version = IO.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION'))
|
48
58
|
op.parse! argv
|
49
|
-
if argv.
|
59
|
+
if config[:mode] != :as3lib && argv.empty?
|
50
60
|
puts op
|
51
61
|
exit 1
|
52
62
|
end
|
data/test/helper.rb
CHANGED
data/test/test_as3gettext.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestAs3gettext < Test::Unit::TestCase
|
4
|
+
context "-g option" do
|
5
|
+
should "generate as3lib" do
|
6
|
+
As3gettext::Command.new.run %W(-g test/works)
|
7
|
+
assert File.exist?('test/works/_.as')
|
8
|
+
assert File.exist?('test/works/com/rails2u/gettext/GetText.as')
|
9
|
+
end
|
10
|
+
end
|
4
11
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
*
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Yuichi Tateno
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-17 00:00:00 +09:00
|
19
19
|
default_executable: as3gettext
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -41,19 +41,21 @@ extra_rdoc_files:
|
|
41
41
|
- ChangeLog
|
42
42
|
- README.rdoc
|
43
43
|
files:
|
44
|
+
- .gitignore
|
44
45
|
- ChangeLog
|
46
|
+
- Gemfile
|
45
47
|
- README.rdoc
|
46
48
|
- Rakefile
|
47
49
|
- VERSION
|
48
50
|
- as3lib/_.as
|
49
51
|
- as3lib/com/rails2u/gettext/GetText.as
|
50
52
|
- bin/as3gettext
|
51
|
-
- lib/as3gettext.rb
|
52
53
|
- lib/as3gettext/as3_parser.rb
|
53
54
|
- lib/as3gettext/command.rb
|
54
55
|
- lib/as3gettext/generate_xml.rb
|
55
56
|
- test/helper.rb
|
56
57
|
- test/test_as3gettext.rb
|
58
|
+
- test/works/.gitignore
|
57
59
|
has_rdoc: true
|
58
60
|
homepage: http://github.com/tosik/as3gettext-oneup
|
59
61
|
licenses: []
|
data/lib/as3gettext.rb
DELETED