Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global: integrate webpack #73

Merged
merged 3 commits into from Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -8,6 +8,10 @@
Changes
=======

Version 1.1.0 (released 2018-11-06)

- Introduce webpack support.

Version 1.0.0 (released 2018-03-23)

- Initial public release.
27 changes: 27 additions & 0 deletions invenio_i18n/assets/js/invenio_i18n/app.js
@@ -0,0 +1,27 @@
/*
* This file is part of Invenio.
* Copyright (C) 2016-2018 CERN.
* Copyright (C) 2016 TIND.
*
* Invenio is free software; you can redistribute it and/or modify it
* under the terms of the MIT License; see LICENSE file for more details.
*/

import angular from "angular";
import "angular-gettext/dist/angular-gettext";
import jquery from "jquery/dist/jquery";

angular.module("langSelector", ["gettext"]).factory("setLanguage", [
"gettextCatalog",
function(gettextCatalog) {
function setCurrentLanguage(lang) {
gettextCatalog.setCurrentLanguage(lang);
}
}
]);

$(document).ready(function() {
$("#lang-code").on("change", function() {
$("#language-code-form").submit();
});
});
2 changes: 1 addition & 1 deletion invenio_i18n/version.py
Expand Up @@ -14,4 +14,4 @@

from __future__ import absolute_import, print_function

__version__ = '1.0.0'
__version__ = '1.1.0'
22 changes: 22 additions & 0 deletions invenio_i18n/webpack.py
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""Webpack bundles for Invenio-I18N."""

from flask_webpackext import WebpackBundle

i18n = WebpackBundle(
__name__,
'assets',
entry={
'i18n_app': './js/invenio_i18n/app.js'
},
dependencies={
'angular': '~1.4.9',
'angular-gettext': '~2.3.8',
})
4 changes: 4 additions & 0 deletions setup.py
Expand Up @@ -47,6 +47,7 @@
install_requires = [
'Flask>=0.11.1',
'Flask-BabelEx>=0.9.2',
'flask-webpackext>=1.0.0',
]

packages = find_packages()
Expand Down Expand Up @@ -81,6 +82,9 @@
'invenio_i18n.translations': [
'messages = invenio_i18n',
],
'invenio_assets.webpack': [
'invenio_i18n = invenio_i18n.webpack:i18n',
],
},
extras_require=extras_require,
install_requires=install_requires,
Expand Down