Commit b780d0e4 authored by Dicson's avatar Dicson

PlaginsTranslations added

parent 64829aa2
from plagins_translations import PlaginsTranslationsPlugin
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="window1">
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">is doing something else</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="inactive">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">is composing a message...</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="composing">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">paused composing a message</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="paused">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="focus_on_click">False</property>
<property name="xalign">0</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="border_width">3</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">is paying attention to the conversation</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="active">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
[info]
name: Plagins translations
short_name: plagins_translations
version: 0.1
description: This plugin contains translations files for Gajim plugins
authors = Denis Fomin <fominde@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki/
This diff is collapsed.
# -*- coding: utf-8 -*-
##
import gobject
import os
from common import gajim
from plugins import GajimPlugin
from plugins.helpers import log_calls
from plugins.plugins_i18n import _
class PlaginsTranslationsPlugin(GajimPlugin):
@log_calls('PlaginsTranslationsPlugin')
def init(self):
self.config_dialog = None
self.config_default_values = {'last_version': '0'}
self.locale_dir = os.path.join(gajim.PLUGINS_DIRS[1], 'locale')
@log_calls('PlaginsTranslationsPlugin')
def activate(self):
if self.config['last_version'] == self.version:
return
from glob import glob
import shutil
files = glob(self.__path__ + '/*.mo')
# remove old data
self.remove_translations()
# create dirs and copy files
os.mkdir(self.locale_dir)
locales = [os.path.splitext(os.path.basename(name))[0] for name in files]
for locale in locales:
dst = os.path.join(os.path.join(self.locale_dir, locale),
'LC_MESSAGES/gajim_plugins.mo')
os.makedirs(os.path.split(dst)[0])
shutil.copy2(os.path.join(self.__path__, '%s.mo' % locale), dst)
def remove_translations(self):
if os.path.isdir(self.locale_dir):
import shutil
shutil.rmtree(self.locale_dir)
@log_calls('PlaginsTranslationsPlugin')
def deactivate(self):
self.remove_translations()
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment