NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

uiutil.py (1755B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\localization\uiutil.py
      2 import re
      3 from carbon.common.script.util import mathUtil
      4 from localization import settings
      5 
      6 def PrepareLocalizationSafeString(textString, messageID = None):
      7     if settings.qaSettings.LocWrapSettingsActive():
      8         return '<localized messageID=%s>%s</localized>' % (messageID, textString)
      9     return textString
     10 
     11 
     12 def IsLocalizationSafeString(textString):
     13     return textString.startswith('<localized') and textString.endswith('localized>')
     14 
     15 
     16 localizedStringRE = re.compile('(<localized.*?>|</localized>)')
     17 messageIDSearchRE = re.compile('(?<=messageID=).*?(?=[ >])', re.I)
     18 COLOR_HARDCODED = mathUtil.LtoI(2868838655L)
     19 _isWrapModeOn = False
     20 
     21 def WrapStringForDisplay(textString):
     22     if not settings.qaSettings.LocWrapSettingsActive():
     23         return textString
     24     parts = localizedStringRE.split(textString)
     25     for index, part in enumerate(parts):
     26         if part == u'</localized>':
     27             if settings.qaSettings.GetValue('showMessageID') or settings.qaSettings.GetValue('enableBoundaryMarkers'):
     28                 parts[index] = '<color=0xaa999999>]</color>' + part
     29         if part.startswith(u'<localized'):
     30             messageID = messageIDSearchRE.findall(part)[0]
     31             boundaryText = ''
     32             messageIDText = ''
     33             if settings.qaSettings.GetValue('showMessageID') or settings.qaSettings.GetValue('enableBoundaryMarkers'):
     34                 boundaryText = '<color=0xaa999999>[</color>'
     35             if settings.qaSettings.GetValue('showMessageID'):
     36                 messageIDText = '<color=0xaa6dcff6>%s: </color>' % messageID
     37             parts[index] = part + boundaryText + messageIDText
     38 
     39     return ''.join(parts)