Skip to content

Conversation

@batcho0428
Copy link
Collaborator

対応Issue

resolve #1992

概要

  • 国際団体に配布する英語版の物品貸出表出力機能を追加
  • 管理者ページにダウンロードボタンを追加
  • ファイル構成変更に合わせてapiを修正
  • 物品名の英語版対応は 国際団体物品貸出表の実装(API) #1992 で実装して、テンプレートの引数は修正する。

実装詳細

  • print_pdf_controllerを修正してGETでlocale=enの場合に英語版を出力する
  • enの場合は、is_internationalがtrueのグループのみにprint_pdf_controllerでフィルターしてから渡す。
  • 日本語文章ファイル.ja.ymlと英語文章ファイルen.ymlを/api/config/locales/all_groups_rental_itemに配置
  • テンプレートのoutput_all_groups\rental_items.pdf.erbはこれらからデータを引っ張ってくるだけ

画面スクリーンショット等

テスト項目

  • データの内容に誤りがないか
  • ファイル名等後々の拡張に影響がないか
  • 英語文章や用語に誤りがないか

備考

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

このPRは国際団体向けの英語版物品貸出表PDF出力機能を実装してるよ〜✨ 管理者画面から英語版をダウンロードできるようにして、国際団体のみをフィルタリングして出力する機能が追加されてるっ💪

Changes:

  • Rails i18nを使った英語・日本語の多言語対応(locale切り替え機能)
  • locale=enパラメータで国際団体(is_international: true)のみフィルタリング
  • 管理画面に英語版PDF専用ダウンロードボタンを追加

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
api/config/locales/all_groups_rental_items/ja.yml 日本語版の翻訳ファイル新規追加 - テンプレートで使用する文言を定義
api/config/locales/all_groups_rental_items/en.yml 英語版の翻訳ファイル新規追加 - 国際団体向け英訳を定義
api/app/views/print_pdf/output_all_groups_rental_items.pdf.erb ハードコードされた日本語文字列をi18nのt()ヘルパーに置き換え、時間表記と単位記号の修正も含む
api/app/controllers/print_pdf_controller.rb localeパラメータ処理と国際団体フィルタリング、I18n.with_localeでのレンダリング制御を追加
api/app/views/print_pdf/output_rental_items_pdf.css CSSネスト記法からフラットなセレクタに修正(技術的な改善)
admin_view/nuxt-project/pages/print/index.vue 英語版PDF専用のダウンロードボタンとハンドラー関数を追加

Comment on lines +31 to +32
- "Check in at the headquarters when returning items."
- "Use the designated pickup and return locations."
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

英語の注意事項の順番が日本語版と違っちゃってるよ💦 日本語版は「場所を間違えない→チェックを受ける→綺麗にする」なのに、英語版は「本部でチェック→場所を守る→綺麗にする」になってて内容も微妙に変わってる😵 翻訳ミスっぽいから、日本語版と同じ順番と意味にした方がいいと思う〜✨

Suggested change
- "Check in at the headquarters when returning items."
- "Use the designated pickup and return locations."
- "Use the designated pickup and return locations."
- "Check in at the headquarters when returning items."

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは対応して――

en:
print_pdf:
output_all_groups_rental_items:
title: "Participating Organization Information Management Chart"
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

英訳がちょっと違うかもっ💦 "Participating Organization Information Management Chart"って長すぎるし、元の日本語「物品貸出表」は"Rental Items List"とか"Equipment Rental Form"の方がピッタリじゃね?🤔 Managementって管理って意味だけど、この表は管理用じゃなくて貸出用だから意味がズレちゃってるよ〜😅

Suggested change
title: "Participating Organization Information Management Chart"
title: "Equipment Rental Form"

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rental Items Listでよさそう。

Comment on lines +16 to +17
locale = params[:locale].presence&.to_sym || :ja
@groups = @groups.where(is_international: true) if locale == :en
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localeの取得処理が2回書かれてて重複しちゃってるっ😅 output_all_groups_rental_items_pdfメソッド(16行目)とprint_pdfメソッド(112行目)の両方で同じことやってるから、DRYじゃないよね💦 16-17行目のlocale取得とフィルタリング処理は残して、print_pdfメソッドに渡す方がスッキリするかもっ✨

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ一旦いらない。
他のpdf出力もlocaleを使うなら引数としてlocaleを渡すようにしたいけどとりあえずはこのままでコメント残しておくとかでもいい。
## 今後の実装によってprint_pdfにlocaleの引数を持たせる。

Comment on lines 14 to 19
def output_all_groups_rental_items_pdf
@groups = Group.where(fes_year_id: params[:fes_year_id]).order(:group_category_id)
locale = params[:locale].presence&.to_sym || :ja
@groups = @groups.where(is_international: true) if locale == :en
print_pdf('output_all_groups_rental_items', 'output_rental_items_pdf', '物品貸出表', 'Not Landscape')
end
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新しいlocaleパラメータとis_internationalフィルタリング機能にテストがないっぽいよ〜💦 output_all_groups_rental_items_pdfアクションのテストを追加して、locale=enの時に正しく国際団体だけフィルタリングされるかとか、I18n.with_localeが正しく動くかチェックした方がいいと思う!🧪 他のコントローラーにはテストあるし、このPRはけっこう重要な機能だからテストカバレッジ欲しいな〜✨

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

できたらあついけどテスト固めてないからなーー

Copy link
Contributor

@hikahana hikahana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

purhaceListの配列直したら動いたーー
出力されるpdfはよさそう~~

Comment on lines 14 to 19
def output_all_groups_rental_items_pdf
@groups = Group.where(fes_year_id: params[:fes_year_id]).order(:group_category_id)
locale = params[:locale].presence&.to_sym || :ja
@groups = @groups.where(is_international: true) if locale == :en
print_pdf('output_all_groups_rental_items', 'output_rental_items_pdf', '物品貸出表', 'Not Landscape')
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

できたらあついけどテスト固めてないからなーー

● 借用および返却時は貸出場所にいる実行委員のチェックを受けてください。<br>
● 備品等は絶対に汚さないように使用し、綺麗にしてから返却してください。
<%= t('.precautions.title') %><br><br>
<% t('.precautions.items').each do |note| %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18nは配列ではなくて文字列らしいので.eachで配列処理をするとエラーになるらしい。
ので配列だよっていうのを明示しておく必要があるって。はえーって感じ。

Suggested change
<% t('.precautions.items').each do |note| %>
<% Array(t('.precautions.items')).each do |note| %>

一応印刷したやつ載せとくーー
物品貸し出し表まとめ(国際団体・英語版) (4).pdf

en:
print_pdf:
output_all_groups_rental_items:
title: "Participating Organization Information Management Chart"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rental Items Listでよさそう。

Comment on lines +31 to +32
- "Check in at the headquarters when returning items."
- "Use the designated pickup and return locations."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは対応して――

Comment on lines +16 to +17
locale = params[:locale].presence&.to_sym || :ja
@groups = @groups.where(is_international: true) if locale == :en
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ一旦いらない。
他のpdf出力もlocaleを使うなら引数としてlocaleを渡すようにしたいけどとりあえずはこのままでコメント残しておくとかでもいい。
## 今後の実装によってprint_pdfにlocaleの引数を持たせる。

@hikahana
Copy link
Contributor

あ、団体のカテゴリの英語対応も必要かも

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

国際団体物品貸出表の実装(API)

3 participants