[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37094] branches/soc-2011-garlic: Almost complete the i18n system, including:

xiao xiangquan xiaoxiangquan at gmail.com
Thu Jun 2 13:22:22 CEST 2011


Revision: 37094
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37094
Author:   xiaoxiangquan
Date:     2011-06-02 11:22:22 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
Almost complete the i18n system, including:
Copy unifont..ttf.gz from source tree to target datafile path( now ONLY works with cmake );
Set the locale the same with system's setting;
If need unicode font, unzip and load unifont when init ui styles;
Apply gettext() to labels in space_info.py, who are the main menu items.

Each of these should have been commit one by one. As they work well according to my tests, so I just lazily send a long list.

Modified Paths:
--------------
    branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_info.py
    branches/soc-2011-garlic/source/blender/blenfont/BLF_api.h
    branches/soc-2011-garlic/source/blender/blenfont/intern/blf.c
    branches/soc-2011-garlic/source/blender/blenfont/intern/blf_lang.c
    branches/soc-2011-garlic/source/blender/blenlib/BLI_fileops.h
    branches/soc-2011-garlic/source/blender/blenlib/BLI_path_util.h
    branches/soc-2011-garlic/source/blender/blenlib/intern/fileops.c
    branches/soc-2011-garlic/source/blender/blenlib/intern/path_util.c
    branches/soc-2011-garlic/source/blender/editors/datafiles/CMakeLists.txt
    branches/soc-2011-garlic/source/blender/editors/include/ED_datafiles.h
    branches/soc-2011-garlic/source/blender/editors/interface/interface_style.c
    branches/soc-2011-garlic/source/blender/windowmanager/intern/wm_init_exit.c
    branches/soc-2011-garlic/source/creator/CMakeLists.txt
    branches/soc-2011-garlic/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

Added Paths:
-----------
    branches/soc-2011-garlic/release/datafiles/fonts/
    branches/soc-2011-garlic/release/datafiles/fonts/unifont-5.1.20080907.ttf.zip
    branches/soc-2011-garlic/source/blender/editors/datafiles/bunifont.ttf.c

Added: branches/soc-2011-garlic/release/datafiles/fonts/unifont-5.1.20080907.ttf.zip
===================================================================
(Binary files differ)


Property changes on: branches/soc-2011-garlic/release/datafiles/fonts/unifont-5.1.20080907.ttf.zip
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + application/octet-stream

Modified: branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_info.py
===================================================================
--- branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_info.py	2011-06-02 09:21:41 UTC (rev 37093)
+++ branches/soc-2011-garlic/release/scripts/startup/bl_ui/space_info.py	2011-06-02 11:22:22 UTC (rev 37094)
@@ -18,6 +18,7 @@
 
 # <pep8 compliant>
 import bpy
+from blf import gettext as _
 
 
 class INFO_HT_header(bpy.types.Header):
@@ -44,7 +45,7 @@
             sub.menu("INFO_MT_help")
 
         if window.screen.show_fullscreen:
-            layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
+            layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text=_("Back to Previous"))
             layout.separator()
         else:
             layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
@@ -70,11 +71,11 @@
         """
         sinfo = context.space_data
         row = layout.row(align=True)
-        row.prop(sinfo, "show_report_debug", text="Debug")
-        row.prop(sinfo, "show_report_info", text="Info")
-        row.prop(sinfo, "show_report_operator", text="Operators")
-        row.prop(sinfo, "show_report_warning", text="Warnings")
-        row.prop(sinfo, "show_report_error", text="Errors")
+        row.prop(sinfo, "show_report_debug", text=_("Debug"))
+        row.prop(sinfo, "show_report_info", text=_("Info"))
+        row.prop(sinfo, "show_report_operator", text=_("Operators"))
+        row.prop(sinfo, "show_report_warning", text=_("Warnings"))
+        row.prop(sinfo, "show_report_error", text=_("Errors"))
 
         row = layout.row()
         row.enabled = sinfo.show_report_operator
@@ -85,7 +86,7 @@
 
 
 class INFO_MT_report(bpy.types.Menu):
-    bl_label = "Report"
+    bl_label = _("Report")
 
     def draw(self, context):
         layout = self.layout
@@ -97,31 +98,31 @@
 
 
 class INFO_MT_file(bpy.types.Menu):
-    bl_label = "File"
+    bl_label = _("File");
 
     def draw(self, context):
         layout = self.layout
 
         layout.operator_context = 'EXEC_AREA'
-        layout.operator("wm.read_homefile", text="New", icon='NEW')
+        layout.operator("wm.read_homefile", text=_("New"), icon='NEW')
         layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
+        layout.operator("wm.open_mainfile", text=_("Open..."), icon='FILE_FOLDER')
         layout.menu("INFO_MT_file_open_recent")
         layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
-        layout.operator("wm.recover_auto_save", text="Recover Auto Save...")
+        layout.operator("wm.recover_auto_save", text=_("Recover Auto Save..."))
 
         layout.separator()
 
         layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK').check_existing = False
+        layout.operator("wm.save_mainfile", text=_("Save"), icon='FILE_TICK').check_existing = False
         layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.save_as_mainfile", text="Save As...")
+        layout.operator("wm.save_as_mainfile", text=_("Save As..."))
         layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.save_as_mainfile", text="Save Copy...").copy = True
+        layout.operator("wm.save_as_mainfile", text=_("Save Copy...")).copy = True
 
         layout.separator()
 
-        layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
+        layout.operator("screen.userpref_show", text=_("User Preferences..."), icon='PREFERENCES')
 
         layout.operator_context = 'EXEC_AREA'
         layout.operator("wm.save_homefile")
@@ -130,8 +131,8 @@
         layout.separator()
 
         layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.link_append", text="Link")
-        props = layout.operator("wm.link_append", text="Append")
+        layout.operator("wm.link_append", text=_("Link"))
+        props = layout.operator("wm.link_append", text=_("Append"))
         props.link = False
         props.instance_groups = False
 
@@ -147,12 +148,12 @@
         layout.separator()
 
         layout.operator_context = 'EXEC_AREA'
-        layout.operator("wm.quit_blender", text="Quit", icon='QUIT')
+        layout.operator("wm.quit_blender", text=_("Quit"), icon='QUIT')
 
 
 class INFO_MT_file_import(bpy.types.Menu):
     bl_idname = "INFO_MT_file_import"
-    bl_label = "Import"
+    bl_label = _("Import")
 
     def draw(self, context):
         if hasattr(bpy.types, "WM_OT_collada_import"):
@@ -161,7 +162,7 @@
 
 class INFO_MT_file_export(bpy.types.Menu):
     bl_idname = "INFO_MT_file_export"
-    bl_label = "Export"
+    bl_label = _("Export")
 
     def draw(self, context):
         if hasattr(bpy.types, "WM_OT_collada_export"):
@@ -169,13 +170,13 @@
 
 
 class INFO_MT_file_external_data(bpy.types.Menu):
-    bl_label = "External Data"
+    bl_label = _("External Data")
 
     def draw(self, context):
         layout = self.layout
 
-        layout.operator("file.pack_all", text="Pack into .blend file")
-        layout.operator("file.unpack_all", text="Unpack into Files")
+        layout.operator("file.pack_all", text=_("Pack into .blend file"))
+        layout.operator("file.unpack_all", text=_("Unpack into Files"))
 
         layout.separator()
 
@@ -187,41 +188,41 @@
 
 class INFO_MT_mesh_add(bpy.types.Menu):
     bl_idname = "INFO_MT_mesh_add"
-    bl_label = "Mesh"
+    bl_label = _("Mesh")
 
     def draw(self, context):
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
-        layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
-        layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
-        layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
-        layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
-        layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
-        layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
-        layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
+        layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text=_("Plane"))
+        layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text=_("Cube"))
+        layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text=_("Circle"))
+        layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text=_("UV Sphere"))
+        layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text=_("Icosphere"))
+        layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text=_("Cylinder"))
+        layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text=_("Cone"))
         layout.separator()
-        layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
-        layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
-        layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
+        layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text=_("Grid"))
+        layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text=_("Monkey"))
+        layout.operator("mesh.primitive_torus_add", text=_("Torus"), icon='MESH_TORUS')
 
 
 class INFO_MT_curve_add(bpy.types.Menu):
     bl_idname = "INFO_MT_curve_add"
-    bl_label = "Curve"
+    bl_label = _("Curve")
 
     def draw(self, context):
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
-        layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
-        layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
-        layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
-        layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
-        layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
+        layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text=_("Bezier"))
+        layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text=_("Circle"))
+        layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text=_("Nurbs Curve"))
+        layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text=_("Nurbs Circle"))
+        layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text=_("Path"))
 
 
 class INFO_MT_edit_curve_add(bpy.types.Menu):
     bl_idname = "INFO_MT_edit_curve_add"
-    bl_label = "Add"
+    bl_label = _("Add")
 
     def draw(self, context):
         is_surf = context.active_object.type == 'SURFACE'
@@ -237,71 +238,71 @@
 
 class INFO_MT_surface_add(bpy.types.Menu):
     bl_idname = "INFO_MT_surface_add"
-    bl_label = "Surface"
+    bl_label = _("Surface")
 
     def draw(self, context):
         layout = self.layout
         layout.operator_context = 'INVOKE_REGION_WIN'
-        layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
-        layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
-        layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
-        layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
-        layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list