Update extension to use ITranslation interface

This commit is contained in:
Mikko Nieminen 2017-02-22 16:39:01 +02:00
parent 6a94f97837
commit 472b56c55a
10 changed files with 12 additions and 9 deletions

View File

@ -2,7 +2,7 @@
host = https://www.transifex.com
[sixodp.ckanext-rating]
file_filter = i18n/<lang>/LC_MESSAGES/ckanext-rating.po
source_file = i18n/ckanext-rating.pot
file_filter = ckanext/rating/i18n/<lang>/LC_MESSAGES/ckanext-rating.po
source_file = ckanext/rating/i18n/ckanext-rating.pot
source_lang = en
type = PO

Binary file not shown.

Binary file not shown.

View File

@ -8,6 +8,7 @@ from ckanext.rating.logic import action
from ckanext.rating import helpers
import ckanext.rating.logic.auth as rating_auth
from ckanext.rating.model import Rating
from ckan.lib.plugins import DefaultTranslation
def sort_by_rating(sort):
@ -46,13 +47,15 @@ def sort_by_rating(sort):
return q
class RatingPlugin(plugins.SingletonPlugin):
class RatingPlugin(plugins.SingletonPlugin, DefaultTranslation):
plugins.implements(plugins.IConfigurer)
plugins.implements(plugins.IActions)
plugins.implements(plugins.ITemplateHelpers)
plugins.implements(plugins.IAuthFunctions)
plugins.implements(plugins.IPackageController, inherit=True)
plugins.implements(plugins.IRoutes, inherit=True)
if toolkit.check_ckan_version(min_version='2.5.0'):
plugins.implements(plugins.ITranslation, inherit=True)
# IConfigurer

View File

@ -1,21 +1,21 @@
[extract_messages]
keywords = translate isPlural
add_comments = TRANSLATORS:
output_file = i18n/ckanext-rating.pot
output_file = ckanext/rating/i18n/ckanext-rating.pot
width = 80
[init_catalog]
domain = ckanext-rating
input_file = i18n/ckanext-rating.pot
output_dir = i18n
input_file = ckanext/rating/i18n/ckanext-rating.pot
output_dir = ckanext/rating/i18n
[update_catalog]
domain = ckanext-rating
input_file = i18n/ckanext-rating.pot
output_dir = i18n
input_file = ckanext/rating/i18n/ckanext-rating.pot
output_dir = ckanext/rating/i18n
previous = true
[compile_catalog]
domain = ckanext-rating
directory = i18n
directory = ckanext/rating/i18n
statistics = true