rails_schema_excel 0.1.4 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83c201c8fe60f4b97fba60b7a97313397bd34da4046ef717118eb4fe5a9ac643
4
- data.tar.gz: 7d92d9e96c69cb14dbaca69a3e3705f8b6bfcec019d3b5be8e212e9cbcdbbed0
3
+ metadata.gz: c751c5957dd22af4545752424f62acccde3fb97ff77ad082ab24245e7215fd3c
4
+ data.tar.gz: 19e1493298e8d3dac82bcca0323e96d39fa1093cc3c905ab342f65123d2b4eaf
5
5
  SHA512:
6
- metadata.gz: 2e62f5d45fb99e46e9b98c995be0fc6786a985e431a79d90dddf2e7b35e567a6627884195be2f4551e6bf8a3c4a077ca7e48c4fc6af4fbc7ebd87a8c32d67b17
7
- data.tar.gz: dd2565aa2142075c667012648849e8a3c9e038fff1665857feefdc1909d159785cc6d3d3fc6e4d1d02c7924d64aced8c092f5328a2bb11da9c4f3fa2965ca8ff
6
+ metadata.gz: 3819187e418ab8003ad2a72fb7e8698e0486b398fb6f57928edfd4d0dbe1bd6c498f2bfcb655d502c54d13194b619e97ef22e05656fbb8c75c28eeabb5573603
7
+ data.tar.gz: 4f24674c4fb11da68c19b7b2f7b186406f32122047a9a1478e02ae5024f313ecd21915c42f6d3c5ff458b540dcd196df9ee78686670afbdbee8255633aa9a195
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
- # RailsSchemaExcel
1
+ # Rails Schema to Excel Converter
2
2
 
3
- Export Rails database schema to Excel format with A5:SQL Mk-2 style layout.
3
+ [![Gem Version](https://badge.fury.io/rb/rails_schema_excel.svg)](https://badge.fury.io/rb/rails_schema_excel)
4
+
5
+ [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/ojisanchamchi)
6
+
7
+ Convert Rails database schema to Excel format with each table as a separate sheet in A5:SQL Mk-2 style.
4
8
 
5
9
  <img width="798" height="637" alt="image" src="https://github.com/user-attachments/assets/d538365c-f83d-4536-890b-a0e7c28da534" />
6
10
 
@@ -20,47 +24,50 @@ Or install it yourself as:
20
24
 
21
25
  $ gem install rails_schema_excel
22
26
 
23
- ## Usage
24
-
25
- ### Command Line
27
+ ## Command Line Usage
26
28
 
27
29
  ```bash
28
- # From Rails root directory (uses db/schema.rb by default)
30
+ # Basic usage (Japanese by default)
29
31
  rails_schema_excel
30
32
 
31
- # Specify schema file and output
32
- rails_schema_excel -s db/schema.rb -o output.xlsx
33
+ # Specify input and output files
34
+ rails_schema_excel -s path/to/schema.rb -o output.xlsx
35
+
36
+ # Specify language (ja, en, ru, zh, vi)
37
+ rails_schema_excel -l en -s schema.rb -o output.xlsx
33
38
 
34
39
  # Show help
35
- rails_schema_excel -h
40
+ rails_schema_excel --help
36
41
  ```
37
42
 
38
- ### In Ruby Code
43
+ ## Supported Languages
39
44
 
40
- ```ruby
41
- require 'rails_schema_excel'
45
+ - `ja` - Japanese (default)
46
+ - `en` - English
47
+ - `ru` - Russian
48
+ - `zh` - Chinese
49
+ - `vi` - Vietnamese
42
50
 
43
- RailsSchemaExcel.export('db/schema.rb', 'schema.xlsx')
44
- ```
45
-
46
- ## Features
51
+ ## Interactive Usage
47
52
 
48
- Each table is exported as a separate Excel sheet with A5:SQL Mk-2 format including:
53
+ The script will prompt for:
54
+ - Path to your Rails `schema.rb` file
55
+ - Output Excel filename (optional, defaults to `schema.xlsx`)
49
56
 
50
- - **テーブル情報** (Table Information)
51
- - **カラム情報** (Column Information) - name, type, not null, default, comments
52
- - **インデックス情報** (Index Information)
53
- - **制約情報** (Constraint Information) - primary keys
54
- - **外部キー情報** (Foreign Key Information)
55
- - **外部キー情報(PK側)** (Foreign Key Information - PK side)
56
- - **トリガー情報** (Trigger Information)
57
- - **RDBMS固有の情報** (RDBMS Specific Information)
57
+ Each database table will be exported as a separate Excel sheet with columns:
58
+ - Column: Column name
59
+ - Type: Data type (string, integer, etc.)
60
+ - Options: Additional options (null constraints, defaults, etc.)
58
61
 
59
62
  ## Development
60
63
 
61
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
64
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
65
+
66
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
67
+
68
+ ## Contributing
62
69
 
63
- To install this gem onto your local machine, run `bundle exec rake install`.
70
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ojisanchamchi/rails_schema_excel.
64
71
 
65
72
  ## License
66
73
 
@@ -16,6 +16,10 @@ OptionParser.new do |opts|
16
16
  options[:output] = file
17
17
  end
18
18
 
19
+ opts.on("-l", "--locale LOCALE", "Language for output (ja, en, ru, zh, vi) (default: ja)") do |locale|
20
+ options[:locale] = locale.to_sym
21
+ end
22
+
19
23
  opts.on("-h", "--help", "Prints this help") do
20
24
  puts opts
21
25
  exit
@@ -24,12 +28,19 @@ end.parse!
24
28
 
25
29
  schema_file = options[:schema] || 'db/schema.rb'
26
30
  output_file = options[:output] || 'schema.xlsx'
31
+ locale = options[:locale] || :ja
27
32
 
28
33
  unless File.exist?(schema_file)
29
34
  puts "Error: #{schema_file} not found"
30
35
  exit 1
31
36
  end
32
37
 
33
- puts "Exporting #{schema_file} to #{output_file}..."
34
- RailsSchemaExcel.export(schema_file, output_file)
38
+ valid_locales = [:ja, :en, :ru, :zh, :vi]
39
+ unless valid_locales.include?(locale)
40
+ puts "Error: Invalid locale '#{locale}'. Valid options: #{valid_locales.join(', ')}"
41
+ exit 1
42
+ end
43
+
44
+ puts "Exporting #{schema_file} to #{output_file} (locale: #{locale})..."
45
+ RailsSchemaExcel.export(schema_file, output_file, locale: locale)
35
46
  puts "Done! Exported to #{output_file}"
@@ -1,19 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'caxlsx'
4
+ require_relative 'i18n'
4
5
 
5
6
  module RailsSchemaExcel
6
7
  class Exporter
7
8
  GREEN = 'FF92D050'
8
9
 
9
- def self.export(tables, output_file)
10
+ def self.export(tables, output_file, locale: :ja)
10
11
  Axlsx::Package.new do |p|
11
12
  tables.each do |table_name, table_data|
12
13
  next if table_data[:columns].empty?
13
14
 
14
15
  sheet_name = table_name[0..30]
15
16
  p.workbook.add_worksheet(name: sheet_name) do |sheet|
16
- create_a5_format(sheet, table_name, table_data)
17
+ create_a5_format(sheet, table_name, table_data, locale)
17
18
  end
18
19
  end
19
20
 
@@ -21,23 +22,23 @@ module RailsSchemaExcel
21
22
  end
22
23
  end
23
24
 
24
- def self.create_a5_format(sheet, table_name, table_data)
25
+ def self.create_a5_format(sheet, table_name, table_data, locale)
25
26
  green_fill = sheet.styles.add_style(bg_color: GREEN, fg_color: '00', b: true, border: Axlsx::STYLE_THIN_BORDER)
26
27
  header_style = sheet.styles.add_style(bg_color: GREEN, fg_color: '00', b: true, border: Axlsx::STYLE_THIN_BORDER, alignment: { horizontal: :center })
27
28
  border_style = sheet.styles.add_style(border: Axlsx::STYLE_THIN_BORDER)
28
29
  bold_style = sheet.styles.add_style(b: true)
29
30
 
30
31
  # テーブル情報
31
- sheet.add_row ['テーブル情報'], style: bold_style
32
+ sheet.add_row [I18n.t(:table_info, locale)], style: bold_style
32
33
  sheet.merge_cells("A1:F1")
33
34
 
34
35
  [
35
- ['システム名', ''],
36
- ['サブシステム名', ''],
37
- ['スキーマ名', table_name],
38
- ['論理テーブル名', ''],
39
- ['物理テーブル名', table_name],
40
- ['備考', '']
36
+ [I18n.t(:system_name, locale), ''],
37
+ [I18n.t(:subsystem_name, locale), ''],
38
+ [I18n.t(:schema_name, locale), table_name],
39
+ [I18n.t(:logical_table_name, locale), ''],
40
+ [I18n.t(:physical_table_name, locale), table_name],
41
+ [I18n.t(:remarks, locale), '']
41
42
  ].each do |label, value|
42
43
  sheet.add_row [label, value], style: [green_fill, border_style]
43
44
  sheet.merge_cells("B#{sheet.rows.length}:C#{sheet.rows.length}")
@@ -46,10 +47,17 @@ module RailsSchemaExcel
46
47
  sheet.add_row []
47
48
 
48
49
  # カラム情報
49
- sheet.add_row ['カラム情報'], style: bold_style
50
+ sheet.add_row [I18n.t(:column_info, locale)], style: bold_style
50
51
  sheet.merge_cells("A#{sheet.rows.length}:F#{sheet.rows.length}")
51
52
 
52
- sheet.add_row ['No', '物理名', 'データ型', 'Not Null', 'デフォルト', '備考'], style: header_style
53
+ sheet.add_row [
54
+ I18n.t(:no, locale),
55
+ I18n.t(:physical_name, locale),
56
+ I18n.t(:data_type, locale),
57
+ I18n.t(:not_null, locale),
58
+ I18n.t(:default, locale),
59
+ I18n.t(:remarks, locale)
60
+ ], style: header_style
53
61
 
54
62
  table_data[:columns].each_with_index do |col, idx|
55
63
  sheet.add_row [
@@ -65,10 +73,17 @@ module RailsSchemaExcel
65
73
  sheet.add_row []
66
74
 
67
75
  # インデックス情報
68
- sheet.add_row ['インデックス情報'], style: bold_style
76
+ sheet.add_row [I18n.t(:index_info, locale)], style: bold_style
69
77
  sheet.merge_cells("A#{sheet.rows.length}:F#{sheet.rows.length}")
70
78
 
71
- sheet.add_row ['No', 'インデックス名', 'カラムリスト', 'キー', 'ユニーク', '備考'], style: header_style
79
+ sheet.add_row [
80
+ I18n.t(:no, locale),
81
+ I18n.t(:index_name, locale),
82
+ I18n.t(:column_list, locale),
83
+ I18n.t(:key, locale),
84
+ I18n.t(:unique, locale),
85
+ I18n.t(:remarks, locale)
86
+ ], style: header_style
72
87
 
73
88
  table_data[:indexes].each_with_index do |idx_data, idx|
74
89
  sheet.add_row [
@@ -84,10 +99,15 @@ module RailsSchemaExcel
84
99
  sheet.add_row []
85
100
 
86
101
  # 制約情報
87
- sheet.add_row ['制約情報'], style: bold_style
102
+ sheet.add_row [I18n.t(:constraint_info, locale)], style: bold_style
88
103
  sheet.merge_cells("A#{sheet.rows.length}:D#{sheet.rows.length}")
89
104
 
90
- sheet.add_row ['No', '制約名', '種類', '制約定義'], style: header_style
105
+ sheet.add_row [
106
+ I18n.t(:no, locale),
107
+ I18n.t(:constraint_name, locale),
108
+ I18n.t(:type, locale),
109
+ I18n.t(:constraint_definition, locale)
110
+ ], style: header_style
91
111
 
92
112
  if table_data[:columns].any? { |col| col[:name] == 'id' }
93
113
  sheet.add_row [1, 'PRIMARY', 'PRIMARY KEY', 'id'], style: border_style
@@ -96,10 +116,16 @@ module RailsSchemaExcel
96
116
  sheet.add_row []
97
117
 
98
118
  # 外部キー情報
99
- sheet.add_row ['外部キー情報'], style: bold_style
119
+ sheet.add_row [I18n.t(:foreign_key_info, locale)], style: bold_style
100
120
  sheet.merge_cells("A#{sheet.rows.length}:E#{sheet.rows.length}")
101
121
 
102
- sheet.add_row ['No', '外部キー名', 'カラムリスト', '参照先テーブル名', '参照先カラムリスト'], style: header_style
122
+ sheet.add_row [
123
+ I18n.t(:no, locale),
124
+ I18n.t(:foreign_key_name, locale),
125
+ I18n.t(:column_list, locale),
126
+ I18n.t(:ref_table_name, locale),
127
+ I18n.t(:ref_column_list, locale)
128
+ ], style: header_style
103
129
 
104
130
  table_data[:foreign_keys].each_with_index do |fk, idx|
105
131
  sheet.add_row [
@@ -114,24 +140,40 @@ module RailsSchemaExcel
114
140
  sheet.add_row []
115
141
 
116
142
  # 外部キー情報(PK側)
117
- sheet.add_row ['外部キー情報(PK側)'], style: bold_style
143
+ sheet.add_row [I18n.t(:foreign_key_pk_info, locale)], style: bold_style
118
144
  sheet.merge_cells("A#{sheet.rows.length}:E#{sheet.rows.length}")
119
145
 
120
- sheet.add_row ['No', '外部キー名', 'カラムリスト', '参照元テーブル名', '参照元カラムリスト'], style: header_style
146
+ sheet.add_row [
147
+ I18n.t(:no, locale),
148
+ I18n.t(:foreign_key_name, locale),
149
+ I18n.t(:column_list, locale),
150
+ I18n.t(:ref_source_table_name, locale),
151
+ I18n.t(:ref_source_column_list, locale)
152
+ ], style: header_style
121
153
  sheet.add_row []
122
154
 
123
155
  # トリガー情報
124
- sheet.add_row ['トリガー情報'], style: bold_style
156
+ sheet.add_row [I18n.t(:trigger_info, locale)], style: bold_style
125
157
  sheet.merge_cells("A#{sheet.rows.length}:E#{sheet.rows.length}")
126
158
 
127
- sheet.add_row ['No', 'トリガー名', 'イベント', 'タイミング', '条件'], style: header_style
159
+ sheet.add_row [
160
+ I18n.t(:no, locale),
161
+ I18n.t(:trigger_name, locale),
162
+ I18n.t(:event, locale),
163
+ I18n.t(:timing, locale),
164
+ I18n.t(:condition, locale)
165
+ ], style: header_style
128
166
  sheet.add_row []
129
167
 
130
168
  # RDBMS固有の情報
131
- sheet.add_row ['RDBMS固有の情報'], style: bold_style
169
+ sheet.add_row [I18n.t(:rdbms_specific_info, locale)], style: bold_style
132
170
  sheet.merge_cells("A#{sheet.rows.length}:C#{sheet.rows.length}")
133
171
 
134
- sheet.add_row ['No', 'プロパティ名', 'プロパティ値'], style: header_style
172
+ sheet.add_row [
173
+ I18n.t(:no, locale),
174
+ I18n.t(:property_name, locale),
175
+ I18n.t(:property_value, locale)
176
+ ], style: header_style
135
177
 
136
178
  [
137
179
  ['TABLE_CATALOG', 'def'],
@@ -0,0 +1,207 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsSchemaExcel
4
+ class I18n
5
+ TRANSLATIONS = {
6
+ ja: {
7
+ table_info: 'テーブル情報',
8
+ system_name: 'システム名',
9
+ subsystem_name: 'サブシステム名',
10
+ schema_name: 'スキーマ名',
11
+ logical_table_name: '論理テーブル名',
12
+ physical_table_name: '物理テーブル名',
13
+ remarks: '備考',
14
+ column_info: 'カラム情報',
15
+ no: 'No',
16
+ physical_name: '物理名',
17
+ data_type: 'データ型',
18
+ not_null: 'Not Null',
19
+ default: 'デフォルト',
20
+ index_info: 'インデックス情報',
21
+ index_name: 'インデックス名',
22
+ column_list: 'カラムリスト',
23
+ key: 'キー',
24
+ unique: 'ユニーク',
25
+ constraint_info: '制約情報',
26
+ constraint_name: '制約名',
27
+ type: '種類',
28
+ constraint_definition: '制約定義',
29
+ foreign_key_info: '外部キー情報',
30
+ foreign_key_name: '外部キー名',
31
+ ref_table_name: '参照先テーブル名',
32
+ ref_column_list: '参照先カラムリスト',
33
+ foreign_key_pk_info: '外部キー情報(PK側)',
34
+ ref_source_table_name: '参照元テーブル名',
35
+ ref_source_column_list: '参照元カラムリスト',
36
+ trigger_info: 'トリガー情報',
37
+ trigger_name: 'トリガー名',
38
+ event: 'イベント',
39
+ timing: 'タイミング',
40
+ condition: '条件',
41
+ rdbms_specific_info: 'RDBMS固有の情報',
42
+ property_name: 'プロパティ名',
43
+ property_value: 'プロパティ値'
44
+ },
45
+ en: {
46
+ table_info: 'Table Information',
47
+ system_name: 'System Name',
48
+ subsystem_name: 'Subsystem Name',
49
+ schema_name: 'Schema Name',
50
+ logical_table_name: 'Logical Table Name',
51
+ physical_table_name: 'Physical Table Name',
52
+ remarks: 'Remarks',
53
+ column_info: 'Column Information',
54
+ no: 'No',
55
+ physical_name: 'Physical Name',
56
+ data_type: 'Data Type',
57
+ not_null: 'Not Null',
58
+ default: 'Default',
59
+ index_info: 'Index Information',
60
+ index_name: 'Index Name',
61
+ column_list: 'Column List',
62
+ key: 'Key',
63
+ unique: 'Unique',
64
+ constraint_info: 'Constraint Information',
65
+ constraint_name: 'Constraint Name',
66
+ type: 'Type',
67
+ constraint_definition: 'Constraint Definition',
68
+ foreign_key_info: 'Foreign Key Information',
69
+ foreign_key_name: 'Foreign Key Name',
70
+ ref_table_name: 'Reference Table Name',
71
+ ref_column_list: 'Reference Column List',
72
+ foreign_key_pk_info: 'Foreign Key Information (PK Side)',
73
+ ref_source_table_name: 'Reference Source Table Name',
74
+ ref_source_column_list: 'Reference Source Column List',
75
+ trigger_info: 'Trigger Information',
76
+ trigger_name: 'Trigger Name',
77
+ event: 'Event',
78
+ timing: 'Timing',
79
+ condition: 'Condition',
80
+ rdbms_specific_info: 'RDBMS Specific Information',
81
+ property_name: 'Property Name',
82
+ property_value: 'Property Value'
83
+ },
84
+ ru: {
85
+ table_info: 'Информация о таблице',
86
+ system_name: 'Имя системы',
87
+ subsystem_name: 'Имя подсистемы',
88
+ schema_name: 'Имя схемы',
89
+ logical_table_name: 'Логическое имя таблицы',
90
+ physical_table_name: 'Физическое имя таблицы',
91
+ remarks: 'Примечания',
92
+ column_info: 'Информация о столбцах',
93
+ no: '№',
94
+ physical_name: 'Физическое имя',
95
+ data_type: 'Тип данных',
96
+ not_null: 'Не NULL',
97
+ default: 'По умолчанию',
98
+ index_info: 'Информация об индексах',
99
+ index_name: 'Имя индекса',
100
+ column_list: 'Список столбцов',
101
+ key: 'Ключ',
102
+ unique: 'Уникальный',
103
+ constraint_info: 'Информация об ограничениях',
104
+ constraint_name: 'Имя ограничения',
105
+ type: 'Тип',
106
+ constraint_definition: 'Определение ограничения',
107
+ foreign_key_info: 'Информация о внешних ключах',
108
+ foreign_key_name: 'Имя внешнего ключа',
109
+ ref_table_name: 'Имя ссылочной таблицы',
110
+ ref_column_list: 'Список ссылочных столбцов',
111
+ foreign_key_pk_info: 'Информация о внешних ключах (сторона PK)',
112
+ ref_source_table_name: 'Имя исходной таблицы',
113
+ ref_source_column_list: 'Список исходных столбцов',
114
+ trigger_info: 'Информация о триггерах',
115
+ trigger_name: 'Имя триггера',
116
+ event: 'Событие',
117
+ timing: 'Время',
118
+ condition: 'Условие',
119
+ rdbms_specific_info: 'Специфичная информация СУБД',
120
+ property_name: 'Имя свойства',
121
+ property_value: 'Значение свойства'
122
+ },
123
+ zh: {
124
+ table_info: '表信息',
125
+ system_name: '系统名称',
126
+ subsystem_name: '子系统名称',
127
+ schema_name: '模式名称',
128
+ logical_table_name: '逻辑表名',
129
+ physical_table_name: '物理表名',
130
+ remarks: '备注',
131
+ column_info: '列信息',
132
+ no: '序号',
133
+ physical_name: '物理名称',
134
+ data_type: '数据类型',
135
+ not_null: '非空',
136
+ default: '默认值',
137
+ index_info: '索引信息',
138
+ index_name: '索引名称',
139
+ column_list: '列列表',
140
+ key: '键',
141
+ unique: '唯一',
142
+ constraint_info: '约束信息',
143
+ constraint_name: '约束名称',
144
+ type: '类型',
145
+ constraint_definition: '约束定义',
146
+ foreign_key_info: '外键信息',
147
+ foreign_key_name: '外键名称',
148
+ ref_table_name: '引用表名',
149
+ ref_column_list: '引用列列表',
150
+ foreign_key_pk_info: '外键信息(主键侧)',
151
+ ref_source_table_name: '引用源表名',
152
+ ref_source_column_list: '引用源列列表',
153
+ trigger_info: '触发器信息',
154
+ trigger_name: '触发器名称',
155
+ event: '事件',
156
+ timing: '时机',
157
+ condition: '条件',
158
+ rdbms_specific_info: '数据库特定信息',
159
+ property_name: '属性名称',
160
+ property_value: '属性值'
161
+ },
162
+ vi: {
163
+ table_info: 'Thông tin bảng',
164
+ system_name: 'Tên hệ thống',
165
+ subsystem_name: 'Tên hệ thống con',
166
+ schema_name: 'Tên schema',
167
+ logical_table_name: 'Tên bảng logic',
168
+ physical_table_name: 'Tên bảng vật lý',
169
+ remarks: 'Ghi chú',
170
+ column_info: 'Thông tin cột',
171
+ no: 'STT',
172
+ physical_name: 'Tên vật lý',
173
+ data_type: 'Kiểu dữ liệu',
174
+ not_null: 'Không NULL',
175
+ default: 'Mặc định',
176
+ index_info: 'Thông tin chỉ mục',
177
+ index_name: 'Tên chỉ mục',
178
+ column_list: 'Danh sách cột',
179
+ key: 'Khóa',
180
+ unique: 'Duy nhất',
181
+ constraint_info: 'Thông tin ràng buộc',
182
+ constraint_name: 'Tên ràng buộc',
183
+ type: 'Loại',
184
+ constraint_definition: 'Định nghĩa ràng buộc',
185
+ foreign_key_info: 'Thông tin khóa ngoại',
186
+ foreign_key_name: 'Tên khóa ngoại',
187
+ ref_table_name: 'Tên bảng tham chiếu',
188
+ ref_column_list: 'Danh sách cột tham chiếu',
189
+ foreign_key_pk_info: 'Thông tin khóa ngoại (phía PK)',
190
+ ref_source_table_name: 'Tên bảng nguồn tham chiếu',
191
+ ref_source_column_list: 'Danh sách cột nguồn tham chiếu',
192
+ trigger_info: 'Thông tin trigger',
193
+ trigger_name: 'Tên trigger',
194
+ event: 'Sự kiện',
195
+ timing: 'Thời điểm',
196
+ condition: 'Điều kiện',
197
+ rdbms_specific_info: 'Thông tin đặc thù CSDL',
198
+ property_name: 'Tên thuộc tính',
199
+ property_value: 'Giá trị thuộc tính'
200
+ }
201
+ }.freeze
202
+
203
+ def self.t(key, locale = :ja)
204
+ TRANSLATIONS.dig(locale, key) || TRANSLATIONS.dig(:ja, key) || key.to_s
205
+ end
206
+ end
207
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsSchemaExcel
4
- VERSION = "0.1.4"
4
+ VERSION = '0.2.1'
5
5
  end
@@ -7,8 +7,8 @@ require_relative "rails_schema_excel/exporter"
7
7
  module RailsSchemaExcel
8
8
  class Error < StandardError; end
9
9
 
10
- def self.export(schema_file, output_file)
10
+ def self.export(schema_file, output_file, locale: :ja)
11
11
  tables = Parser.parse(schema_file)
12
- Exporter.export(tables, output_file)
12
+ Exporter.export(tables, output_file, locale: locale)
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_schema_excel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dang Quang Minh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-08 00:00:00.000000000 Z
11
+ date: 2025-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caxlsx
@@ -40,8 +40,7 @@ dependencies:
40
40
  version: '0.6'
41
41
  description: 'Convert Rails database schema to Excel format with each table as a separate
42
42
  sheet in A5:SQL Mk-2 style. Usage: rails_schema_excel -i schema.rb -o out.xlsx'
43
- email:
44
- - d-minh@ruby-dev.vn
43
+ email: ojisanchamchi@gmail.com
45
44
  executables:
46
45
  - rails_schema_excel
47
46
  extensions: []
@@ -52,6 +51,7 @@ files:
52
51
  - exe/rails_schema_excel
53
52
  - lib/rails_schema_excel.rb
54
53
  - lib/rails_schema_excel/exporter.rb
54
+ - lib/rails_schema_excel/i18n.rb
55
55
  - lib/rails_schema_excel/parser.rb
56
56
  - lib/rails_schema_excel/version.rb
57
57
  homepage: https://github.com/ojisanchamchi/rails_schema_excel
@@ -61,6 +61,7 @@ metadata:
61
61
  homepage_uri: https://github.com/ojisanchamchi/rails_schema_excel
62
62
  source_code_uri: https://github.com/ojisanchamchi/rails_schema_excel
63
63
  changelog_uri: https://github.com/ojisanchamchi/rails_schema_excel/blob/main/CHANGELOG.md
64
+ github_repo: https://github.com/ojisanchamchi/rails_schema_excel
64
65
  post_install_message:
65
66
  rdoc_options: []
66
67
  require_paths: