Skip to content

Commit

Permalink
Merge d878961 into e6c6a01
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewm89 committed Dec 2, 2016
2 parents e6c6a01 + d878961 commit 894cbea
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .tx/config
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand Down
11 changes: 6 additions & 5 deletions MANIFEST.in
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand All @@ -22,19 +22,20 @@
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

include .dockerignore
include .editorconfig
include .tx/config
include *.rst
include *.sh
include *.txt
include .dockerignore
include .editorconfig
include .lgtm
include .tx/config
include LICENSE
include MAINTAINERS
include babel.ini
include docs/requirements.txt
include pytest.ini
recursive-include docs *.bat *.py *.rst Makefile
recursive-include examples *.html *.po *.py *.sh
recursive-include invenio_i18n *.js
recursive-include invenio_i18n *.po *.mo *.pot *.html
recursive-include tests *.po *.mo *.py
recursive-include examples *.html *.po *.py *.sh
2 changes: 1 addition & 1 deletion README.rst
@@ -1,6 +1,6 @@
..
This file is part of Invenio.
Copyright (C) 2015 CERN.
Copyright (C) 2015, 2016 CERN.
Invenio is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
@@ -1,6 +1,6 @@
..
This file is part of Invenio.
Copyright (C) 2015 CERN.
Copyright (C) 2015, 2016 CERN.
Invenio is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
Expand Down
2 changes: 1 addition & 1 deletion examples/app.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand Down
2 changes: 1 addition & 1 deletion invenio_i18n/babel.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand Down
38 changes: 38 additions & 0 deletions invenio_i18n/bundles.py
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.

"""Bundles for Invenio-I18N."""

from __future__ import absolute_import, print_function

from invenio_assets import NpmBundle, RequireJSFilter

js = NpmBundle(
"js/invenio_i18n/angularLangSelector.js",
filters=RequireJSFilter(),
output='gen/i18n.%(version)s.js',
npm={
"angular-gettext": "~2.3.8",
}
)
36 changes: 36 additions & 0 deletions invenio_i18n/static/js/invenio_i18n/angularLangSelector.js
@@ -0,0 +1,36 @@
/* -*- coding: utf-8 -*-
*
* This file is part of Invenio.
* Copyright (C) 2016 CERN.
*
* Invenio is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* Invenio is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Invenio; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*
* In applying this license, CERN does not
* waive the privileges and immunities granted to it by virtue of its status
* as an Intergovernmental Organization or submit itself to any jurisdiction.
*/

require([
"node_modules/angular/angular",
"node_modules/angular-gettext/dist/angular-gettext"
], function() {
angular.module("langSelector", ["gettext"])
.factory("setLanguage", ["gettextCatalog", function(gettextCatalog){
function setCurrentLanguage(lang) {
gettextCatalog.setCurrentLanguage(lang);
}
}]);
});
@@ -1,7 +1,7 @@
{# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
Expand Down
1 change: 1 addition & 0 deletions invenio_i18n/views.py
Expand Up @@ -35,6 +35,7 @@
'invenio_i18n',
__name__,
template_folder='templates',
static_folder='static',
)


Expand Down
8 changes: 6 additions & 2 deletions setup.py
Expand Up @@ -32,15 +32,16 @@
history = open('CHANGES.rst').read()

tests_require = [
'Flask-Login>=0.3.0',
'check-manifest>=0.25',
'coverage>=4.0',
'invenio-assets>=1.0.0a4',
'isort>=4.2.2',
'pydocstyle>=1.0.0',
'pytest-cache>=1.0',
'pytest-cov>=1.8.0',
'pytest-pep8>=1.0.6',
'pytest>=2.8.0,<3.0.0',
'Flask-Login>=0.3.0',
'pytest>=2.8.0',
]

extras_require = {
Expand Down Expand Up @@ -87,6 +88,9 @@
include_package_data=True,
platforms='any',
entry_points={
'invenio_assets.bundles': [
'invenio_i18n_js = invenio_i18n.bundles:js',
],
'invenio_base.apps': [
'invenio_i18n = invenio_i18n:InvenioI18N',
],
Expand Down
10 changes: 10 additions & 0 deletions tests/test_invenio_i18n.py
Expand Up @@ -32,6 +32,7 @@
from flask import render_template_string
from flask_babelex import format_datetime, format_number, get_locale, \
gettext, lazy_gettext
from invenio_assets import InvenioAssets
from pytz import timezone

from invenio_i18n.babel import set_locale
Expand Down Expand Up @@ -207,3 +208,12 @@ def test_jinja_templates(app):
== 'English'
assert render_template_string('{{"da"|language_name_local}}') \
== 'dansk'


def test_bundles(app):
"""Test package bundles."""
InvenioAssets(app)

with app.app_context():
from invenio_i18n.bundles import js
assert js

0 comments on commit 894cbea

Please sign in to comment.