gai18n 0.1.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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +94 -0
  3. data/Rakefile +15 -0
  4. data/bin/gai18n +6 -0
  5. metadata +145 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 80ea1d6a4a1a9340d8149b99546887182e9e8c8111e5d97aabc3443e495e7518
4
+ data.tar.gz: 87973911b51f123a2a49b1729dc97385bffeee649663dd5fda836f2537f64b10
5
+ SHA512:
6
+ metadata.gz: bcde0839b720b180d9e97cddccc3a8de21e05a2cd2094054f6015f87c87248bcd61a8e7fbb1c4502e7678b7cc1c53ea835cf01b9f24a31c3afc0b93a8e0daf03
7
+ data.tar.gz: 713b081ea1ac3d8b1b2d20be55a7e5f6f307fc81a51ac9411de7680def97eee5a829f0626a2d50632f21569583c3547f5d42a73bb3cde26c22460887a90000e4
data/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # GAI18n
2
+
3
+ GAI18n uses OpenAI's Assistant API to translate source language files to target
4
+ language files. It is packaged as a gem and should work well in Rails or plain
5
+ Ruby applications.
6
+
7
+ ## Setup
8
+
9
+ ### Install the gem
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'gai18n'
14
+ ```
15
+
16
+ Then install the gem by running the following command:
17
+ ```bash
18
+ $ bundle install
19
+ ```
20
+
21
+ ### Initial Setup
22
+
23
+ Please add the gai18n.rb configuration file. You can do this
24
+ by running the following command, `bundle exec gai18n setup`.
25
+
26
+ ```bash
27
+ # generate the gai18n.rb configuration file. If you have a `config` directory,
28
+ # gai18n.rb file will be created in that directory. Otherwise, it will be
29
+ # created in the current project directory.
30
+ $ bundle exec gai18n setup
31
+
32
+
33
+ # Same as the above, but it will also set the OpenAI secret key in the file.
34
+ $ bundle exec gai18n setup -s your_openai_secret_key
35
+ ```
36
+
37
+ Ensure the `gai18n.rb` configuration file is set up with your
38
+ `openai_secret_key`. Then you can run the following command to create an
39
+ Assistant in your OpenAI account and set the Assistant id in the configuration.
40
+
41
+ ```bash
42
+ $ bundle exec gai18n assistant:create
43
+ ```
44
+
45
+ Copy the Assistant id from the command's response and set it in the `gai18n.rb`
46
+ configuration file.
47
+
48
+ NOTE: Do not use an Assistant that was created separately. It must be created
49
+ by the `bundle exec gai18n assistant:create` command due to the unique
50
+ instructions required for the Assistant to work with this gem.
51
+
52
+ ## Usage
53
+
54
+ To translate your source language file(s) to the target language file(s), run:
55
+
56
+ ```ruby
57
+ $ bundle exec gai18n translate
58
+ ```
59
+
60
+ This will translate the source language file(s) to the target language file(s)
61
+ and save the translated content in the target language file(s). The source
62
+ language file(s) will not be modified. The translated content will be merged
63
+ with the existing content in the target language file(s) or create a new
64
+ target language file(s) if it does not exist.
65
+
66
+ ## Configuration
67
+
68
+ For all configuration options, please see the `gai18n.rb` file that was created
69
+ during the setup process. It contains annotations for each configuration option.
70
+
71
+ # Contributing
72
+
73
+ Bug reports and pull requests are welcome.
74
+
75
+ To get started:
76
+ - Fork the repository
77
+ - Clone the repository to your local machine
78
+ - cd into this directory and run `bundle install`
79
+ - Make your changes
80
+ - Run the tests with `bundle exec rake`
81
+ - Commit your changes
82
+ - Push your changes to your fork
83
+ - Open a pull request to this repository
84
+
85
+ # Code of Conduct
86
+
87
+ This project is intended to be a safe,
88
+ welcoming space for collaboration, and contributors are expected to adhere to the
89
+ [Contributor Covenant](https://www.contributor-covenant.org) code of conduct.
90
+
91
+ # License
92
+
93
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
94
+ ```
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'rspec/core/rake_task'
4
+
5
+ begin
6
+ require 'bundler/setup'
7
+ rescue LoadError
8
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
9
+ end
10
+
11
+ RSpec::Core::RakeTask.new(:spec) do |t|
12
+ t.rspec_opts = '--pattern spec/**/*_spec.rb'
13
+ end
14
+
15
+ task default: %i[spec]
data/bin/gai18n ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gai18n'
4
+ require 'gai18n/cli'
5
+
6
+ GAI18n::CLI.new.run(ARGV)
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gai18n
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Philip Q Nguyen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-03-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby-openai
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: git
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.19'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.19'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.12'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.12'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.19'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.19'
97
+ - !ruby/object:Gem::Dependency
98
+ name: debug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Use Generative AI to generate I18n translations.
112
+ email:
113
+ - supertaru@gmail.com
114
+ executables:
115
+ - gai18n
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - README.md
120
+ - Rakefile
121
+ - bin/gai18n
122
+ homepage: https://github.com/philipqnguyen/gai18n
123
+ licenses: []
124
+ metadata:
125
+ allowed_push_host: https://rubygems.org
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 3.0.0
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubygems_version: 3.4.19
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Generative AI for I18n
145
+ test_files: []