From 38a8dab100d17aeddc0d58f7f7bfab98608c494b Mon Sep 17 00:00:00 2001 From: Colin Basnett Date: Tue, 1 Aug 2023 21:49:29 -0700 Subject: [PATCH] Initial commit for Japanese translations --- io_scene_psk_psa/__init__.py | 6 ++++++ io_scene_psk_psa/i18n.py | 18 ++++++++++++++++++ io_scene_psk_psa/psa/export/operators.py | 15 ++++++++++----- io_scene_psk_psa/psa/export/properties.py | 8 ++++---- io_scene_psk_psa/psa/import_/properties.py | 6 +++--- io_scene_psk_psa/psa/import_/ui.py | 2 +- io_scene_psk_psa/psk/import_/operators.py | 15 +++++++-------- io_scene_psk_psa/types.py | 6 +++--- 8 files changed, 52 insertions(+), 24 deletions(-) create mode 100644 io_scene_psk_psa/i18n.py diff --git a/io_scene_psk_psa/__init__.py b/io_scene_psk_psa/__init__.py index 5acf976..1106c9a 100644 --- a/io_scene_psk_psa/__init__.py +++ b/io_scene_psk_psa/__init__.py @@ -16,6 +16,7 @@ if 'bpy' in locals(): importlib.reload(psx_data) importlib.reload(psx_helpers) importlib.reload(psx_types) + importlib.reload(psx_i18n) importlib.reload(psk_data) importlib.reload(psk_reader) @@ -42,6 +43,7 @@ else: from . import data as psx_data from . import helpers as psx_helpers from . import types as psx_types + from . import i18n as psx_i18n from .psk import data as psk_data from .psk import reader as psk_reader from .psk import writer as psk_writer @@ -99,6 +101,7 @@ def psa_import_menu_func(self, context): def register(): for cls in classes: bpy.utils.register_class(cls) + bpy.types.TOPBAR_MT_file_export.append(psk_export_menu_func) bpy.types.TOPBAR_MT_file_import.append(psk_import_menu_func) bpy.types.TOPBAR_MT_file_export.append(psa_export_menu_func) @@ -108,8 +111,11 @@ def register(): bpy.types.Scene.psk_export = PointerProperty(type=psk_export_properties.PSK_PG_export) bpy.types.Action.psa_export = PointerProperty(type=psx_types.PSX_PG_action_export) + bpy.app.translations.register(__name__, psx_i18n.langs) + def unregister(): + bpy.app.translations.unregister(__name__) del bpy.types.Scene.psa_import del bpy.types.Scene.psa_export del bpy.types.Scene.psk_export diff --git a/io_scene_psk_psa/i18n.py b/io_scene_psk_psa/i18n.py new file mode 100644 index 0000000..a67c7cb --- /dev/null +++ b/io_scene_psk_psa/i18n.py @@ -0,0 +1,18 @@ +langs = { + 'ja_JP': { + ('*', 'Bone Length'): 'ボーンの長さ', + ('*', 'Extra UVs'): '追加のUV', + ('*', 'Vertex Color Space'): '頂点カラーの色空間', + ('*', 'Dependencies'): '依存関係', + ('*', 'All dependencies are installed'): 'すべての依存関係がインストールされています', + ('*', 'Reinstall'): '再インストール', + ('*', 'Root Motion'): 'ルートモーション', + ('*', 'Action Metadata'): 'アクションのメタデータ', # TODO: this should probably be removed in favor of directly using the values in the property groups + ('*', 'PSA Export'): 'PSAエクスポート', + ('*', 'Compression Ratio'): '圧縮率', + ('*', 'Keyframe Quota'): 'キーフレームのクォータ', + ('*', 'The minimum number of keyframes to be exported'): 'エクスポートするキーフレームの最小数', + ('*', 'Select a PSA file'): 'PSAファイルを選択', + ('*', 'Case Insensitive'): '大文字小文字を区別しない', + } +} diff --git a/io_scene_psk_psa/psa/export/operators.py b/io_scene_psk_psa/psa/export/operators.py index a5ee85e..2bbf937 100644 --- a/io_scene_psk_psa/psa/export/operators.py +++ b/io_scene_psk_psa/psa/export/operators.py @@ -246,19 +246,24 @@ class PSA_OT_export(Operator, ExportHelper): layout = self.layout pg = getattr(context.scene, 'psa_export') + flow = layout.grid_flow() + flow.use_property_split = True + flow.use_property_decorate = False + # FPS - layout.prop(pg, 'fps_source', text='FPS') + fps_row = flow.row(align=True) + fps_row.prop(pg, 'fps_source', text='FPS') if pg.fps_source == 'CUSTOM': - layout.prop(pg, 'fps_custom', text='Custom') + fps_row.prop(pg, 'fps_custom', text='') # SOURCE - layout.prop(pg, 'sequence_source', text='Source') + flow.prop(pg, 'sequence_source', text='Source') if pg.sequence_source == 'TIMELINE_MARKERS': # ANIMDATA SOURCE - layout.prop(pg, 'should_override_animation_data') + flow.prop(pg, 'should_override_animation_data') if pg.should_override_animation_data: - layout.prop(pg, 'animation_data_override', text='') + flow.prop(pg, 'animation_data_override', text='') # SELECT ALL/NONE row = layout.row(align=True) diff --git a/io_scene_psk_psa/psa/export/properties.py b/io_scene_psk_psa/psa/export/properties.py index 1f75f74..14d0853 100644 --- a/io_scene_psk_psa/psa/export/properties.py +++ b/io_scene_psk_psa/psa/export/properties.py @@ -85,7 +85,7 @@ class PSA_PG_export(PropertyGroup): options=empty_set, description='', items=( - ('ALL', 'All', 'All bones will be exported.'), + ('ALL', 'All', 'All bones will be exported'), ('BONE_GROUPS', 'Bone Groups', 'Only bones belonging to the selected bone groups and their ancestors will ' 'be exported.'), ) @@ -112,18 +112,18 @@ class PSA_PG_export(PropertyGroup): description='Invert filtering (show hidden items, and vice versa)') sequence_filter_asset: BoolProperty( default=False, - name='Show assets', + name='Assets', options=empty_set, description='Show actions that belong to an asset library') sequence_filter_pose_marker: BoolProperty( default=True, - name='Show pose markers', + name='Pose Markers', options=empty_set) sequence_use_filter_sort_reverse: BoolProperty(default=True, options=empty_set) sequence_filter_reversed: BoolProperty( default=True, options=empty_set, - name='Show Reversed', + name='Reversed', description='Show reversed sequences' ) diff --git a/io_scene_psk_psa/psa/import_/properties.py b/io_scene_psk_psa/psa/import_/properties.py index b90ade6..f05a948 100644 --- a/io_scene_psk_psa/psa/import_/properties.py +++ b/io_scene_psk_psa/psa/import_/properties.py @@ -57,11 +57,11 @@ class PSA_PG_import(PropertyGroup): 'Recommended if you do not plan on editing the actions directly' ) bone_mapping_mode: EnumProperty( - name='Bone Mapping', + name='Bone Name Mapping', options=empty_set, - description='The method by which bones from the incoming PSA file are mapped to the armature', + description='The method by which bones from the PSA file are mapped to the bones of the armature', items=( - ('EXACT', 'Exact', 'Bone names must match exactly.', 'EXACT', 0), + ('EXACT', 'Exact', 'Bone names must match exactly', 'EXACT', 0), ('CASE_INSENSITIVE', 'Case Insensitive', 'Bones names must match, ignoring case (e.g., the bone PSA bone ' '\'root\' can be mapped to the armature bone \'Root\')', 'CASE_INSENSITIVE', 1), ) diff --git a/io_scene_psk_psa/psa/import_/ui.py b/io_scene_psk_psa/psa/import_/ui.py index 597c134..ec512e2 100644 --- a/io_scene_psk_psa/psa/import_/ui.py +++ b/io_scene_psk_psa/psa/import_/ui.py @@ -11,7 +11,7 @@ class PSA_UL_sequences(UIList): column = split.row(align=True) column.alignment = 'LEFT' column.prop(item, 'is_selected', icon_only=True) - column.label(text=getattr(item, 'action_name')) + column.label(text=getattr(item, 'action_name'), translate=False) def draw_filter(self, context, layout): pg = getattr(context.scene, 'psa_import') diff --git a/io_scene_psk_psa/psk/import_/operators.py b/io_scene_psk_psa/psk/import_/operators.py index 1cabb22..db484fd 100644 --- a/io_scene_psk_psa/psk/import_/operators.py +++ b/io_scene_psk_psa/psk/import_/operators.py @@ -54,13 +54,12 @@ class PSK_OT_import(Operator, ImportHelper): ) should_import_mesh: BoolProperty( default=True, - name='Import Mesh', - options=empty_set, - description='Import mesh' + name='Mesh', + options=empty_set ) should_import_materials: BoolProperty( default=True, - name='Import Materials', + name='Materials', options=empty_set, ) should_reuse_materials: BoolProperty( @@ -71,9 +70,9 @@ class PSK_OT_import(Operator, ImportHelper): ) should_import_skeleton: BoolProperty( default=True, - name='Import Skeleton', + name='Armature', options=empty_set, - description='Import skeleton' + description='Armature' ) bone_length: FloatProperty( default=1.0, @@ -81,8 +80,8 @@ class PSK_OT_import(Operator, ImportHelper): step=100, soft_min=1.0, name='Bone Length', - options=empty_set, - description='Length of the bones' + subtype='DISTANCE', + options=empty_set ) should_import_shape_keys: BoolProperty( default=True, diff --git a/io_scene_psk_psa/types.py b/io_scene_psk_psa/types.py index 26688b0..e42621c 100644 --- a/io_scene_psk_psa/types.py +++ b/io_scene_psk_psa/types.py @@ -7,7 +7,7 @@ class PSX_UL_bone_group_list(UIList): def draw_item(self, context: Context, layout: UILayout, data: AnyType, item: AnyType, icon: int, active_data: AnyType, active_property: str, index: int = 0, flt_flag: int = 0): row = layout.row() - row.prop(item, 'is_selected', text=getattr(item, 'name')) + row.prop(item, 'is_selected', text=item.name, translate=item.name == 'Unassigned') row.label(text=str(getattr(item, 'count')), icon='BONE_DATA') @@ -19,8 +19,8 @@ class PSX_PG_bone_group_list_item(PropertyGroup): class PSX_PG_action_export(PropertyGroup): - compression_ratio: FloatProperty(name='Compression Ratio', default=1.0, min=0.0, max=1.0, subtype='FACTOR', description='The key sampling ratio of the exported sequence.\n\nA compression ratio of 1.0 will export all frames, while a compression ratio of 0.5 will export half of the frames') - key_quota: IntProperty(name='Key Quota', default=0, min=1, description='The minimum number of frames to be exported') + compression_ratio: FloatProperty(name='Compression Ratio', default=1.0, min=0.0, max=1.0, subtype='FACTOR', description='The keyframe sampling ratio of the exported sequence.\n\nA compression ratio of 1.0 will export all frames, while a compression ratio of 0.5 will export half of the frames') + key_quota: IntProperty(name='Keyframe Quota', default=0, min=1, description='The minimum number of keyframes to be exported') class PSX_PT_action(Panel):