示例#1
0
 def getGlobalPOTimestamp(self, locale):
     '''
     @see: IPOFileManager.getGlobalPOTimestamp
     '''
     try:
         locale = Locale.parse(locale)
     except UnknownLocaleError:
         raise InvalidLocaleError(locale)
     return self._lastModified(locale)
示例#2
0
 def getPluginPOTimestamp(self, plugin, locale):
     '''
     @see: IPOFileManager.getComponentPOTimestamp
     '''
     assert isinstance(plugin, str), 'Invalid plugin id %s' % plugin
     try:
         locale = Locale.parse(locale)
     except UnknownLocaleError:
         raise InvalidLocaleError(locale)
     return self._lastModified(locale, plugin=plugin)
示例#3
0
 def getGlobalPOFile(self, locale):
     '''
     @see: IPOFileManager.getGlobalPOFile
     '''
     try:
         locale = Locale.parse(locale)
     except UnknownLocaleError:
         raise InvalidLocaleError(locale)
     catalog = self._build(locale, self.messageService.getMessages(),
                           self._filePath(locale))
     return self._toPOFile(catalog)
示例#4
0
 def getComponentPOTimestamp(self, component, locale):
     '''
     @see: IPOFileManager.getComponentPOTimestamp
     '''
     assert isinstance(component,
                       str), 'Invalid component id %s' % component
     try:
         locale = Locale.parse(locale)
     except UnknownLocaleError:
         raise InvalidLocaleError(locale)
     return self._lastModified(locale, component=component)
示例#5
0
 def getPluginAsDict(self, plugin, locale):
     '''
     @see: IPOFileManager.getPluginAsDict
     '''
     try:
         locale = Locale.parse(locale)
     except UnknownLocaleError:
         raise InvalidLocaleError(locale)
     messages = self.messageService.getPluginMessages(plugin)
     catalog = self._build(locale, messages,
                           self._filePath(locale, plugin=plugin),
                           self._filePath(locale))
     return self._toDict(plugin, catalog)
示例#6
0
 def getComponentAsDict(self, component, locale):
     '''
     @see: IPOFileManager.getComponentAsDict
     '''
     try:
         locale = Locale.parse(locale)
     except UnknownLocaleError:
         raise InvalidLocaleError(locale)
     messages = self.messageService.getComponentMessages(component)
     catalog = self._build(locale, messages,
                           self._filePath(locale, component=component),
                           self._filePath(locale))
     return self._toDict(component, catalog)
示例#7
0
    def getGlobalAsDict(self, locale):
        '''
        @see: IPOFileManager.getGlobalAsDict
        '''
        try:
            locale = Locale.parse(locale)
        except UnknownLocaleError:
            raise InvalidLocaleError(locale)

        messages = self.messageService.getMessages(qs=QSource(
            type=TYPE_JAVA_SCRIPT))
        catalog = self._build(locale, messages, self._filePath(locale))
        return self._toDict('', catalog)
示例#8
0
    def updateGlobalPOFile(self, locale, poFile):
        '''
        @see: IPOFileManager.updateGlobalPOFile
        '''
        try:
            locale = Locale.parse(locale)
        except UnknownLocaleError:
            raise InvalidLocaleError(locale)
        assert isinstance(poFile,
                          IInputStream), 'Invalid file object %s' % poFile

        return self._update(locale, self.messageService.getMessages(), poFile,
                            self._filePath(locale),
                            self._filePath(locale, format=FORMAT_MO))