Skip to content

Instantly share code, notes, and snippets.

@nutti
Last active August 29, 2015 14:19
Show Gist options
  • Save nutti/0f6ac9b86a2667c4f899 to your computer and use it in GitHub Desktop.
Save nutti/0f6ac9b86a2667c4f899 to your computer and use it in GitHub Desktop.
Translation in Blender add-on
import bpy
translation_dict = {
"ja_JP": {("*", "key1"):"hoge"},
"en_US": {("*", "key1"):"test"}}
class TranslationTestClass(bpy.types.Operator):
bl_idname = "uv.translation_test"
def execute(self, context):
self.report({'INFO'}, bpy.app.translations.pgettext("key1"))
return {'FINISHED'}
def register():
bpy.utils.register_module(__name__)
bpy.app.translations.register(__name__, translation_dict)
def unregister():
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment