Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
add: ignore users locales in muc
Browse files Browse the repository at this point in the history
  • Loading branch information
disabler committed Apr 2, 2013
1 parent 002fa16 commit 5cae2f0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions data/locales/ru.txt
Expand Up @@ -958,6 +958,7 @@ Command prefix: %s Префикс команд: %s
Uptime: %s, Last session: %s Время работы: %s, Последняя сессия: %s
Total Error(s): %s\n Ошибки: %s\n
No Errors Нет ошибок
In current MUC used default locale for all users. В текущей конференции используется локализация по умолчанию для всех участников.
For %s i'll use locale: %s Для %s я использую локализацию: %s
For %s detected unknown locale: %s. Used default locale: %s У %s определена неизвестная локализация: %s. Используется локализация по умолчанию: %s
Locale for %s not found! Used default locale: %s Локализация %s не определена. Используется локализация по умолчанию: %s
Expand Down Expand Up @@ -1073,6 +1074,8 @@ ACL multiaction is %s Мультидействия в ACL %s
Execute more than one action per pass in ACL. Исполнять более одного действия за один проход в ACL.
Paste xhtml images %s Размещать xhtml изображения: %s
Detect and paste xhtml images in messages Определение и размещение xhtml изображений в сообщениях
Use default locale %s Использовать локализацию по умолчанию: %s
Ignore locale settings and use default bot locale Игнорировать локализации и использовать локализацию бота по умолчанию
Muc filter is %s Muc-фильтр: %s
Message filter for participants Фильтр сообщений для участников
Mute all private messages %s Подавление всех приватных сообщений %s
Expand Down
4 changes: 2 additions & 2 deletions kernel.py
Expand Up @@ -1382,7 +1382,7 @@ def disconnecter():
time.sleep(2)

def get_L_(jid):
try: loc = users_locale[jid] if jid else CURRENT_LOCALE
try: loc = users_locale[jid] if jid and not get_config(getRoom(room),'use_default_locale') else CURRENT_LOCALE
except: loc = CURRENT_LOCALE
if not locales.has_key(loc): loc = CURRENT_LOCALE
return loc
Expand All @@ -1394,7 +1394,7 @@ def L(*par):
loc = get_L_(jid)
try: return locales[loc][text]
except: return text

def get_id():
global id_count
id_count += 1
Expand Down
17 changes: 10 additions & 7 deletions plugins/main.py
Expand Up @@ -631,12 +631,14 @@ def get_nick_by_jid_res(room, jid):
return None

def info_lang(type, jid, nick, text):
if not text: text = nick
if users_locale.has_key('%s/%s'%(jid,text)):
cur_lang = users_locale['%s/%s'%(jid,text)]
if locales.has_key(cur_lang): msg = L('For %s i\'ll use locale: %s','%s/%s'%(jid,nick)) % (text,cur_lang.upper())
else: msg = L('For %s detected unknown locale: %s. Used default locale: %s','%s/%s'%(jid,nick)) % (text,cur_lang.upper(),CURRENT_LOCALE.upper())
else: msg = L('Locale for %s not found! Used default locale: %s','%s/%s'%(jid,nick)) % (text,CURRENT_LOCALE.upper())
if get_config(getRoom(jid),'use_default_locale'): msg = L('In current MUC used default locale for all users.','%s/%s'%(jid,nick))
else:
if not text: text = nick
if users_locale.has_key('%s/%s'%(jid,text)):
cur_lang = users_locale['%s/%s'%(jid,text)]
if locales.has_key(cur_lang): msg = L('For %s i\'ll use locale: %s','%s/%s'%(jid,nick)) % (text,cur_lang.upper())
else: msg = L('For %s detected unknown locale: %s. Used default locale: %s','%s/%s'%(jid,nick)) % (text,cur_lang.upper(),CURRENT_LOCALE.upper())
else: msg = L('Locale for %s not found! Used default locale: %s','%s/%s'%(jid,nick)) % (text,CURRENT_LOCALE.upper())
send_msg(type, jid, nick, msg)

def info_whois(type, jid, nick, text):
Expand Down Expand Up @@ -1551,6 +1553,7 @@ def load_page(page_name, parameters=None):
'make_stanza_jid_count':[L('Jid\'s per stanza for affiliations in backup is %s'),L('Count of jid\'s per stanza for affiliations change in backup'),None,'100'],
'acl_multiaction': [L('ACL multiaction is %s'), L('Execute more than one action per pass in ACL.'), [True,False], False],
'paste_xhtml_images': [L('Paste xhtml images %s'), L('Detect and paste xhtml images in messages'), [True,False], True],
'use_default_locale': [L('Use default locale %s'), L('Ignore locale settings and use default bot locale'), [True,False], False],

# MUC-Filter messages

Expand Down Expand Up @@ -1671,7 +1674,7 @@ def load_page(page_name, parameters=None):

config_group_other = [L('Other settings'),'#room-other',
['url_title','parse_define','clear_answer','smiles','autoturn','make_stanza_jid_count','content_length','acl_multiaction',
'paste_xhtml_images'],None]
'paste_xhtml_images','use_default_locale'],None]

config_group_censor = [L('Censor settings'),'#room-censor',
['censor','censor_warning','censor_action_member','censor_action_non_member',
Expand Down

0 comments on commit 5cae2f0

Please sign in to comment.