Browse Source

Make error messages displayed on screen translatable.

Add French translation for these messages.
6.0
Alexis de Lattre 14 years ago
parent
commit
e6ff4c1d88
  1. 26
      asterisk_click2dial/asterisk_click2dial.py
  2. 66
      asterisk_click2dial/i18n/asterisk_click2dial.pot
  3. 66
      asterisk_click2dial/i18n/fr_FR.po

26
asterisk_click2dial/asterisk_click2dial.py

@ -24,6 +24,8 @@ from osv import osv, fields
import socket import socket
# Lib required to print logs # Lib required to print logs
import netsvc import netsvc
# Lib to translate error messages
from tools.translate import _
class asterisk_server(osv.osv): class asterisk_server(osv.osv):
@ -120,10 +122,10 @@ class asterisk_server(osv.osv):
# the OpenERP numbers. # the OpenERP numbers.
def reformat_number(self, cr, uid, ids, erp_number, ast_server, context): def reformat_number(self, cr, uid, ids, erp_number, ast_server, context):
logger = netsvc.Logger() logger = netsvc.Logger()
error_title_msg = "Invalid phone number"
invalid_international_format_msg = "The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42"
invalid_national_format_msg = "The phone number is not written in valid national format."
invalid_format_msg = "The phone number is not written in valid format."
error_title_msg = _("Invalid phone number")
invalid_international_format_msg = _("The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42")
invalid_national_format_msg = _("The phone number is not written in valid national format.")
invalid_format_msg = _("The phone number is not written in valid format.")
# Let's call the variable tmp_number now # Let's call the variable tmp_number now
tmp_number = erp_number tmp_number = erp_number
@ -190,21 +192,23 @@ class asterisk_server(osv.osv):
# Check if the number to dial is not empty # Check if the number to dial is not empty
if not erp_number: if not erp_number:
raise osv.except_osv('Error', 'There is no phone number !')
raise osv.except_osv(_('Error :'), _('There is no phone number !'))
# Note : if I write 'Error' without ' :', it won't get translated...
# I don't understand why !
# We check if the user has an Asterisk server configured # We check if the user has an Asterisk server configured
if not user.asterisk_server_id.id: if not user.asterisk_server_id.id:
raise osv.except_osv('No Asterisk server configured for the current user', "You must associate an Asterisk server to the current user.")
raise osv.except_osv(_('Error :'), _('No Asterisk server configured for the current user.'))
else: else:
ast_server = user.asterisk_server_id ast_server = user.asterisk_server_id
# We check if the current user has a chan type # We check if the current user has a chan type
if not user.asterisk_chan_type: if not user.asterisk_chan_type:
raise osv.except_osv('No channel type configured for the current user', "You must configure an Asterisk channel type for the current user.")
raise osv.except_osv(_('Error :'), _('No channel type configured for the current user.'))
# We check if the current user has an internal number # We check if the current user has an internal number
if not user.internal_number: if not user.internal_number:
raise osv.except_osv('No internal phone number configured for the current user', "You must configure an internal phone number for the current user.")
raise osv.except_osv(_('Error :'), _('No internal phone number configured for the current user'))
# Convert the phone number in the format that will be sent to Asterisk # Convert the phone number in the format that will be sent to Asterisk
ast_number = self.reformat_number(cr, uid, ids, erp_number, ast_server, context=context) ast_number = self.reformat_number(cr, uid, ids, erp_number, ast_server, context=context)
@ -215,8 +219,8 @@ class asterisk_server(osv.osv):
try: try:
ast_ip = socket.gethostbyname(str(ast_server.ip_address)) ast_ip = socket.gethostbyname(str(ast_server.ip_address))
except: except:
logger.notifyChannel('asterisk_click2dial', netsvc.LOG_DEBUG, "Can't resolve the Asterisk server's DNS : " + str(ast_server.ip_address))
raise osv.except_osv('Wrong DNS', "Can't resolve the DNS name of the Asterisk server.")
logger.notifyChannel('asterisk_click2dial', netsvc.LOG_DEBUG, "Can't resolve the DNS of the Asterisk server : " + str(ast_server.ip_address))
raise osv.except_osv(_('Error :'), _("Can't resolve the DNS of the Asterisk server : ") + str(ast_server.ip_address))
try: try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((ast_ip, ast_server.port)) sock.connect((ast_ip, ast_server.port))
@ -237,7 +241,7 @@ class asterisk_server(osv.osv):
sock.close() sock.close()
except: except:
logger.notifyChannel('asterisk_click2dial', netsvc.LOG_WARNING, "Click2dial failed : unable to connect to Asterisk") logger.notifyChannel('asterisk_click2dial', netsvc.LOG_WARNING, "Click2dial failed : unable to connect to Asterisk")
raise osv.except_osv('Asterisk server unreachable', "The connection from OpenERP to the Asterisk server failed. Please check the configuration on OpenERP and on Asterisk.")
raise osv.except_osv(_('Error :'), _("The connection from OpenERP to the Asterisk server failed. Please check the configuration on OpenERP and on Asterisk."))
logger.notifyChannel('asterisk_click2dial', netsvc.LOG_INFO, "Asterisk Click2Dial from " + user.internal_number + ' to ' + ast_number) logger.notifyChannel('asterisk_click2dial', netsvc.LOG_INFO, "Asterisk Click2Dial from " + user.internal_number + ' to ' + ast_number)
asterisk_server() asterisk_server()

66
asterisk_click2dial/i18n/asterisk_click2dial.pot

@ -332,3 +332,69 @@ msgstr ""
msgid "You should enter a 'Wait time' value between 1 and 120 seconds" msgid "You should enter a 'Wait time' value between 1 and 120 seconds"
msgstr "" msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "Can't resolve the DNS of the Asterisk server : "
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "Invalid phone number"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "The phone number is not written in valid national format."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "The phone number is not written in valid format."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "Error :"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "There is no phone number !"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "No Asterisk server configured for the current user."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "No channel type configured for the current user."
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "No internal phone number configured for the current user"
msgstr ""
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "The connection from OpenERP to the Asterisk server failed. Please check the configuration on OpenERP and on Asterisk."
msgstr ""

66
asterisk_click2dial/i18n/fr_FR.po

@ -326,3 +326,69 @@ msgstr "Port"
msgid "Zap" msgid "Zap"
msgstr "Zap" msgstr "Zap"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "Can't resolve the DNS of the Asterisk server : "
msgstr "Impossible de résoudre la DNS du serveur Asterisk : "
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "Invalid phone number"
msgstr "Numéro de téléphone invalide"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42"
msgstr "Le numéro de téléphone n'est pas dans un format international valide. Exemple de numéro de téléphone dans un format international valide : +33 1 41 98 12 42"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "The phone number is not written in valid national format."
msgstr "Le numéro de téléphone n'est pas dans un format national valide."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "The phone number is not written in valid format."
msgstr "Le numéro de téléphone n'est pas dans un format valide."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "Error :"
msgstr "Erreur :"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "There is no phone number !"
msgstr "Il n'y a pas de numéro de téléphone !"
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "No Asterisk server configured for the current user."
msgstr "Aucun serveur Asterisk n'est configuré pour le présent utilisateur."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "No channel type configured for the current user."
msgstr "Aucun type de canal n'est configuré pour le présent utilisateur."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "No internal phone number configured for the current user"
msgstr "Aucun numéro de téléphone interne n'est configuré pour le présent utilisateur."
#. module: asterisk_click2dial
#: code:addons/asterisk_click2dial/asterisk_click2dial.py:0
#, python-format
msgid "The connection from OpenERP to the Asterisk server failed. Please check the configuration on OpenERP and on Asterisk."
msgstr "La connexion depuis OpenERP vers le serveur Asterisk a échoué. Vérifiez la configuration côté OpenERP et côté Asterisk."
Loading…
Cancel
Save