Giter Site home page Giter Site logo

skylinemarketing / devices.sensor.community Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opendata-stuttgart/devices.sensor.community

0.0 2.0 0.0 4.04 MB

Home Page: https://devices.sensor.community

Dockerfile 0.18% JavaScript 6.43% CSS 4.73% Python 55.48% Mako 0.25% HTML 31.68% Shell 0.05% SCSS 1.20%

devices.sensor.community's Introduction

devices.sensor.community

sensor.community self-service registration portal.

Translations

The files for translation can be found in the folder translations/<language ISO code>/LC_MESSAGES/. Both files flask_security.po and messages.po need to be translated.

There is a free tool to edit and translate these files: https://poedit.net/

Manual translation

Example for translation of a one line text:
msgid "Indoor Sensor" <- english
msgstr "Indoor-Sensor" <- translation

Example for translation of a text with more than one line:
(every line has to start and to end with a double quote, first line contains 2 double quote only)
msgid ""
"Mark sensor as inactive. No notifications will be sent when sensor goes "
"offline."
msgstr ""
"Markiert den Sensor als inaktiv. Es werden keine Benachrichtigungen mehr "
"versendet, wenn der Sensor keine Daten mehr liefert."

If you don't have a Github account download the two files via the Raw button directly right over their source code. Send us your file with the translation to "tech (at) sensor.community".

Configuration file

Default configuration settings (set from webapp/default_settings.py) are suitable for running in non-production Docker environment. If you need to override any configuration variables, you can create webapp/config.py file based off webapp/config.py.dist.

Additionally, when running outside of docker, .flaskenv file is required. Basic development environment file can be copied from .flaskenv.dist.

virtualenv setup

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

Database intialization

flask db upgrade

# Create initial user and roles
flask users create [email protected] --password password -a
flask roles create admin
flask roles add [email protected] admin

Running

flask run

Docker development

To ease up development Docker container and relevant docker-compose.yml project file has been created. Following will start up basic development environment including MySQL database with "external" schema and redis. Code reloads are active by default.

docker-compose up

Web application is available on http://localhost:5000/

To create new database migration:

docker-compose run --rm web flask db migrate -m 'Short change summary'

Flask environment can be overriden by modifying docker-compose.yml only.

Gulp automatic rebuilds

To start automatic CSS/JS rebuilds on change use this:

docker-compose run --rm gulp npm start

Create new language

extract text and lazy_gettext() functions
venv/bin/pybabel extract -F ./babel/babel.cfg -k lazy_gettext -o ./babel/messages.pot .
update language
venv/bin/pybabel extract -F ./babel/babel.cfg -k -l -o ./babel/messages.pot .
venv/bin/pybabel update -i ./babel/messages.pot -d ./translations
figure out the country code
venv/bin/pybabel --list-locales
create translation files

replace the country_code with the language to be translated, e.g. pt for Portugese

venv/bin/pybabel init -i ./babel/messages.pot -d ./translations -l country_code
venv/bin/pybabel init -i ./babel/flask_security.pot -D flask_security -d ./translations -l country_code
translate the strings

inside translations/country_code translate the two created files message.po and flask_security.po.

compile into binary
venv/bin/pybabel compile -d ./translations/
venv/bin/pybabel compile -d ./translations/ -D flask_security
extend the default_settgings.py

in line 111 extend the object with the new language. Please add in the previous line a comma at the end.

LANGUAGES = {
    'en': 'English', # add a comma
    'pt': 'Português' # add the new language
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.