🔧
Weblate のデータベースを調査
書きかけのまま公開します🙇
前回の関連記事
この記事を書いたきっかけ
Re: [Linuxjm-discuss] Weblate からのプッシュ試験 | linuxjm
- Weblate のコミットメッセージを変更したいという要望
- しかし、コミットメッセージの設定はコンポーネント単位
- 200以上あるコンポーネントの設定を手作業で修正するのは現実的ではない
- コミットメッセージの設定がどのように格納されているか調べてみよう
データベース環境
PostgreSQL 17.5
コミットメッセージの設定はどのように格納されているのか?
関連ソース
weblate/weblate/trans/models/component.py
654行辺りから定義されている以下のフィールドが該当すると思われる。
| フィールド名 | 設定名 | デフォルト値の環境変数 |
|---|---|---|
| commit_message | 翻訳時のコミットメッセージ | DEFAULT_COMMIT_MESSAGE |
| add_message | 翻訳追加時のコミットメッセージ | DEFAULT_ADD_MESSAGE |
| delete_message | 翻訳削除時のコミットメッセージ | DEFAULT_DELETE_MESSAGE |
| merge_message | 翻訳マージの際のコミットメッセージ | DEFAULT_MERGE_MESSAGE |
| addon_message | アドオンが変更を行った際のコミットメッセージ | DEFAULT_ADDON_MESSAGE |
| pull_message | マージリクエストのメッセージ | DEFAULT_PULL_MESSAGE |
フィールド名からテーブルを検索
# select table_name, column_name from information_schema.columns where column_name ='commit_message';
table_name | column_name
-----------------+----------------
trans_component | commit_message
(1 row)
関連ソースから類推はできたのですが、trans_component というテーブルに格納されているようです。
実際の格納状況を確認
GNU_autoconf コンポーネント を例に commit_message フィールドの内容を表示してみる。
# select commit_message from trans_component where name = 'GNU_autoconf';
commit_message
---------------------------------------------------------------------------------------------------------------
Translated using Weblate ({{ language_name }})\r +
\r +
Currently translated at {{ stats.translated_percent }}% ({{ stats.translated }} of {{ stats.all }} strings)\r+
\r +
Translation: {{ project_name }}/{{ component_name }}\r +
Translate-URL: {{ url }}
(1 row)
ここまで分かれば、一括更新ができそうです。 😄
以下、余裕がある時に更新します 🙇
テーブル一覧
| テーブル名 | 説明 | model path |
|---|---|---|
| accounts_auditlog | ||
| accounts_profile | ||
| accounts_profile_languages | ||
| accounts_profile_secondary_languages | ||
| accounts_profile_watched | ||
| accounts_subscription | ||
| accounts_verifiedemail | ||
| addons_addon | ||
| addons_addonactivitylog | ||
| addons_event | ||
| auth_group | ||
| auth_group_permissions | ||
| auth_permission | ||
| authtoken_token | ||
| checks_check | ||
| configuration_setting | ||
| django_admin_log | ||
| django_celery_beat_clockedschedule | ||
| django_celery_beat_crontabschedule | ||
| django_celery_beat_intervalschedule | ||
| django_celery_beat_periodictask | ||
| django_celery_beat_periodictasks | ||
| django_celery_beat_solarschedule | ||
| django_content_type | ||
| django_migrations | ||
| django_otp_webauthn_webauthnattestation | ||
| django_otp_webauthn_webauthncredential | ||
| django_otp_webauthn_webauthnuserhandle | ||
| django_session | ||
| fonts_font | ||
| fonts_fontgroup | ||
| fonts_fontoverride | ||
| lang_language | ||
| lang_plural | ||
| memory_memory | ||
| metrics_metric | ||
| otp_static_staticdevice | ||
| otp_static_statictoken | ||
| otp_totp_totpdevice | ||
| screenshots_screenshot | ||
| screenshots_screenshot_units | ||
| social_auth_association | ||
| social_auth_code | ||
| social_auth_nonce | ||
| social_auth_partial | ||
| social_auth_usersocialauth | ||
| trans_alert | ||
| trans_announcement | ||
| trans_autocomponentlist | ||
| trans_category | ||
| trans_change | ||
| trans_comment | ||
| trans_component | 翻訳コンポーネントの管理用 | weblate/weblate/trans/models/component.py |
| trans_component_links | ||
| trans_componentlist | ||
| trans_componentlist_components | ||
| trans_contributoragreement | ||
| trans_label | ||
| trans_project | ||
| trans_suggestion | ||
| trans_translation | ||
| trans_unit | ||
| trans_unit_labels | ||
| trans_variant | ||
| trans_variant_defining_units | ||
| trans_vote | ||
| trans_workflowsetting | ||
| weblate_auth_autogroup | ||
| weblate_auth_group | ||
| weblate_auth_group_admins | ||
| weblate_auth_group_componentlists | ||
| weblate_auth_group_components | ||
| weblate_auth_group_languages | ||
| weblate_auth_group_projects | ||
| weblate_auth_group_roles | ||
| weblate_auth_invitation | ||
| weblate_auth_permission | ||
| weblate_auth_role | ||
| weblate_auth_role_permissions | ||
| weblate_auth_user | ||
| weblate_auth_user_groups | ||
| weblate_auth_userblock | ||
| wladmin_backuplog | ||
| wladmin_backupservice | ||
| wladmin_configurationerror | ||
| wladmin_supportstatus |
シーケンス一覧
| シーケンス名 | テーブル名 | 列名 |
|---|---|---|
| accounts_auditlog_id_seq | ||
| accounts_profile_id_seq | ||
| accounts_profile_languages_id_seq | ||
| accounts_profile_secondary_languages_id_seq | ||
| accounts_profile_watched_id_seq | ||
| accounts_subscription_id_seq | ||
| accounts_verifiedemail_id_seq | ||
| addons_addon_id_seq | ||
| addons_addonactivitylog_id_seq | ||
| addons_event_id_seq | ||
| auth_group_id_seq | ||
| auth_group_permissions_id_seq | ||
| auth_permission_id_seq | ||
| checks_check_id_seq | ||
| configuration_setting_id_seq | ||
| django_admin_log_id_seq | ||
| django_celery_beat_clockedschedule_id_seq | ||
| django_celery_beat_crontabschedule_id_seq | ||
| django_celery_beat_intervalschedule_id_seq | ||
| django_celery_beat_periodictask_id_seq | ||
| django_celery_beat_solarschedule_id_seq | ||
| django_content_type_id_seq | ||
| django_migrations_id_seq | ||
| django_otp_webauthn_webauthnattestation_id_seq | ||
| django_otp_webauthn_webauthncredential_id_seq | ||
| fonts_font_id_seq | ||
| fonts_fontgroup_id_seq | ||
| fonts_fontoverride_id_seq | ||
| lang_language_id_seq | ||
| lang_plural_id_seq | ||
| memory_memory_id_seq | ||
| metrics_metric_id_seq | ||
| otp_static_staticdevice_id_seq | ||
| otp_static_statictoken_id_seq | ||
| otp_totp_totpdevice_id_seq | ||
| screenshots_screenshot_id_seq | ||
| screenshots_screenshot_units_id_seq | ||
| social_auth_association_id_seq | ||
| social_auth_code_id_seq | ||
| social_auth_nonce_id_seq | ||
| social_auth_partial_id_seq | ||
| social_auth_usersocialauth_id_seq | ||
| trans_alert_id_seq | ||
| trans_announcement_id_seq | ||
| trans_autocomponentlist_id_seq | ||
| trans_category_id_seq | ||
| trans_change_id_seq | ||
| trans_comment_id_seq | ||
| trans_component_id_seq | ||
| trans_component_links_id_seq | ||
| trans_componentlist_components_id_seq | ||
| trans_componentlist_id_seq | ||
| trans_contributoragreement_id_seq | ||
| trans_label_id_seq | ||
| trans_project_id_seq | ||
| trans_suggestion_id_seq | ||
| trans_translation_id_seq | ||
| trans_unit_id_seq | ||
| trans_unit_labels_id_seq | ||
| trans_variant_defining_units_id_seq | ||
| trans_variant_id_seq | ||
| trans_vote_id_seq | ||
| trans_workflowsetting_id_seq | ||
| weblate_auth_autogroup_id_seq | ||
| weblate_auth_group_admins_id_seq | ||
| weblate_auth_group_componentlists_id_seq | ||
| weblate_auth_group_components_id_seq | ||
| weblate_auth_group_id_seq | ||
| weblate_auth_group_languages_id_seq | ||
| weblate_auth_group_projects_id_seq | ||
| weblate_auth_group_roles_id_seq | ||
| weblate_auth_permission_id_seq | ||
| weblate_auth_role_id_seq | ||
| weblate_auth_role_permissions_id_seq | ||
| weblate_auth_user_groups_id_seq | ||
| weblate_auth_user_id_seq | ||
| weblate_auth_userblock_id_seq | ||
| wladmin_backuplog_id_seq | ||
| wladmin_backupservice_id_seq | ||
| wladmin_configurationerror_id_seq | ||
| wladmin_supportstatus_id_seq |
参考文献
- コミット、追加、削除、マージ、アドオン、およびマージ リクエストのメッセージ
- 【備忘録】postgresqlでカラム名からテーブルを検索する方法 #SQL - Qiita
- PostgreSQL | 作成済みのテーブル一覧を表示する
- PostgreSQLのシーケンス確認と設定 #, - Qiita
- PostgreSQLでCSVファイルをインポート/エクスポートする方法 | アシスト
- CSVをMarkdownのテーブルに変換するVSCode拡張を作ってみた - たけぞう瀕死ブログ
- 【PostgreSQL】Markdown形式のテーブル定義書を自動生成するツールを作ってみた #Java - Qiita ※今回は使用していません
Discussion