def getGlobalPOTimestamp(self, locale): ''' @see: IPOFileManager.getGlobalPOTimestamp ''' try: locale = Locale.parse(locale) except UnknownLocaleError: raise InvalidLocaleError(locale) return self._lastModified(locale)
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)
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)
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)
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)
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)
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)
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))