Internationalisation map

This commit is contained in:
Simon 2021-02-14 15:42:43 +00:00
parent 63ebdc0b88
commit 0600332980
2 changed files with 59 additions and 4 deletions

View File

@ -56,6 +56,9 @@ from mk_voice import pkt_gen
#Read voices
from read_ambe import readAMBE
#Remap some words for certain languages
from i8n_voice_map import voiceMap
#MySQL
from mysql_config import useMYSQL
@ -441,7 +444,7 @@ def disconnectedVoice(system):
_say.append(words['silence'])
_say.append(words['linkedto'])
_say.append(words['silence'])
_say.append(words['2'])
_say.append(words['to'])
_say.append(words['silence'])
_say.append(words['silence'])
@ -1514,7 +1517,7 @@ class routerHBP(HBSYSTEM):
_say.append(words['silence'])
_say.append(words['linkedto'])
_say.append(words['silence'])
_say.append(words['2'])
_say.append(words['to'])
_say.append(words['silence'])
_say.append(words['silence'])
@ -1534,7 +1537,7 @@ class routerHBP(HBSYSTEM):
_say.append(words['silence'])
_say.append(words['linkedto'])
_say.append(words['silence'])
_say.append(words['2'])
_say.append(words['to'])
_say.append(words['silence'])
_say.append(words['silence'])
@ -1869,8 +1872,17 @@ if __name__ == '__main__':
words = AMBEobj.readfiles()
logger.info('(AMBE) Read %s words into voice dict',len(words) - 1)
#Remap words for internationalisation
if CONFIG['GLOBAL']['ANNOUNCEMENT_LANGUAGE'] in voiceMap:
logger.info('(AMBE) i8n voice map entry for language %s',CONFIG['GLOBAL']['ANNOUNCEMENT_LANGUAGE'])
_map = voiceMap[CONFIG['GLOBAL']['ANNOUNCEMENT_LANGUAGE']]
for _mapword in _map:
logger.info('(AMBE) Mapping \"%s\" to \"%s\"',_mapword,_map[_mapword])
words[_mapword] = words.pop(_map[_mapword])
# HBlink instance creation
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
logger.info('(GLOBAL) FreeDMR \'bridge_master.py\' -- SYSTEM STARTING...')
listeningPorts = {}

43
i8n_voice_map.py Normal file
View File

@ -0,0 +1,43 @@
voiceMap = {
'en_GB': {
'to': '2',
},
'en_US:': {
'to': '2',
},
'es_ES': {
'to': 'silence'
},
'fr_FR': {
'to': 'silence'
},
'de_DE': {
'to': 'silence'
},
'dk_DK': {
'to': 'silence'
},
'it_IT': {
'to': 'silence'
},
'no_NO': {
'to': 'silence'
},
'pl_PL': {
'to': 'silence'
},
'se_SE': {
'to': 'silence'
}
}