user: What is Bpy.App.Translations and how is it used in Blender Python scripting?

assistant: , id_cachefile=’CacheFile’, id_camera=’Camera’, id_collection=’Collection’, id_curves=’Curves’, id_curve=’Curve’, id_fs_linestyle=’FreestyleLineStyle’, id_gpencil=’GPencil’, id_id=’ID’, id_image=’Image’, id_lattice=’Lattice’, id_library=’Library’, id_light=’Light’, id_lightprobe=’LightProbe’, id_mask=’Mask’, id_material=’Material’, id_mesh=’Mesh’, id_metaball=’Metaball’, id_movieclip=’MovieClip’, id_nodetree=’NodeTree’, id_object=’Object’, id_paintcurve=’PaintCurve’, id_palette=’Palette’, id_particlesettings=’ParticleSettings’, id_pointcloud=’PointCloud’, id_scene=’Scene’, id_screen=’Screen’, id_sequence=’Sequence’, id_shapekey=’Key’, id_simulation=’Simulation’, id_sound=’Sound’, id_speaker=’Speaker’, id_text=’Text’, id_texture=’Texture’, id_vfont=’VFont’, id_volume=’Volume’, id_windowmanager=’WindowManager’, id_workspace=’WorkSpace’, id_world=’World’, editor_filebrowser=’File browser’, editor_python_console=’Python console’, editor_preferences=’Preferences’, editor_view3d=’View3D’, amount=’Amount’, color=’Color’, constraint=’Constraint’, modifier=’Modifier’, navigation=’Navigation’, render_layer=’Render Layer’, time=’Time’, unit=’Unit’) bpy.app.translations. locale_explode ( locale ) ¶ Return all components and their combinations of the given ISO locale string. >>> bpy . app . translations . locale_explode ( "sr_RS@latin" ) ("sr", "RS", "latin", "sr_RS", "sr@latin") For non-complete locales, missing elements will be None. Parameters : locale – The ISO locale string to explode. Returns : A tuple (language, country, variant, language_country, language&#64;variant) . bpy.app.translations. pgettext ( msgid , msgctxt = None ) ¶ Try to translate the given msgid (with optional msgctxt). Note The (msgid, msgctxt) parameters order has been switched compared to gettext function, to allow single-parameter calls (context then defaults to BLT_I18NCONTEXT_DEFAULT). Note You should really rarely need to use this function in regular addon code, as all translation should be handled by Blender internal code. The only exception are string containing formatting (like “File: %r”), but you should rather use pgettext_iface() / pgettext_tip() in those cases! Note Does nothing when Blender is built without internationalization support (hence always returns msgid ). Parameters : msgid ( str ) – The string to translate. msgctxt ( str | None ) – The translation context (defaults to BLT_I18NCONTEXT_DEFAULT). Returns : The translated string (or msgid if no translation was found). bpy.app.translations. pgettext_data ( msgid , msgctxt = None ) ¶ Try to translate the given msgid (with optional msgctxt), if new data name’s translation is enabled. Note See pgettext() notes. Parameters : msgid ( str ) – The string to translate. msgctxt ( str | None ) – The translation context (defaults to BLT_I18NCONTEXT_DEFAULT). Returns : The translated string (or msgid if no translation was found). bpy.app.translations. pgettext_iface ( msgid , msgctxt = None ) ¶ Try to translate the given msgid (with optional msgctxt), if labels’ translation is enabled. Note See pgettext() notes. Parameters : msgid ( str ) – The string to translate. msgctxt ( str | None ) – The translation context (defaults to BLT_I18NCONTEXT_DEFAULT). Returns : The translated string (or msgid if no translation was found). bpy.app.translations. pgettext_n ( msgid , msgctxt = None ) ¶ Extract the given msgid to translation files. This is a no-op function that will only mark the string to extract, but not perform the actual translation. Note See pgettext() notes. Parameters : msgid ( str ) – The string to extract. msgctxt ( str | None ) – The translation context (defaults to BLT_I18NCONTEXT_DEFAULT). Returns : The original string. bpy.app.translations. pgettext_rpt ( msgid , msgctxt = None ) ¶ Try to translate the given msgid (with optional msgctxt), if reports’ translation is enabled. Note See pgettext() notes. Parameters : msgid ( str ) – The string to translate. msgctxt ( str | None ) – The translation context (defaults to BLT_I18NCONTEXT_DEFAULT). Returns : The translated string (or msgid if no translation was found). bpy.app.translations. pgettext_tip ( msgid , msgctxt = None ) ¶ Try to translate the given msgid (with optional msgctxt), if tooltips’ translation is enabled. Note See pgettext() notes. Parameters : msgid ( str ) – The string to translate. msgctxt ( str | None ) – The translation context (defaults to BLT_I18NCONTEXT_DEFAULT). Returns : The translated string (or msgid if no translation was found). bpy.app.translations. register ( module_name , translations_dict ) ¶ Registers an addon’s UI translations. Note Does nothing when Blender is built without internationalization support. Parameters : module_name ( str ) – The name identifying the addon. translations_dict ( dict [ str , dict [ str , str ] ] ) – A dictionary built like that: {locale: {msg_key: msg_translation, ...}, ...} bpy.app.translations. unregister ( module_name ) ¶ Unregisters an addon’s UI translations. Note Does nothing when Blender is built without internationalization support. Parameters : module_name ( str ) – The name identifying the addon. Next Application Icons (bpy.app.icons) Previous Application Handlers (bpy.app.handlers) Copyright &#169; Blender Authors Made with Furo Report issue on this page On this page Application Translations (bpy.app.translations) Introduction Module References locale locales contexts_C_to_py contexts locale_explode() pgettext() pgettext_data() pgettext_iface() pgettext_n() pgettext_rpt() pgettext_tip() register() unregister()