Coder Social home page Coder Social logo

00mjk / labs-tools-isa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wikimedia/labs-tools-isa

0.0 0.0 0.0 1.08 MB

Github mirror of "labs/tools/Isa" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)

Python 32.74% Shell 0.34% CSS 5.76% JavaScript 30.65% HTML 30.51%

labs-tools-isa's Introduction

Isa

This tool helps to describe the images contributed to Wiki Loves competitions.

Isa is not only an acronym for information structured additions, but is also a chiShona language word for โ€˜putโ€™.

Requirements

Installing dependencies

Install application dependencies using the get-deps.sh script:

./get-deps.sh

The above script attempts to check system requirements and informs user on next steps.

Quickstart the app

export FLASK_APP=app.py # add --reload parameter to enable Flask auto-compilation feature
flask run

Managing Translations

Steps 1 to 3a below show how to extract and generate translation files from the source code.

Start from step 3b if you are only adding a new supported language for the app.

Start from step 4 if you are only adding translated text for already supported languages.

Skip directly to step 5 if you have pulled changes which include updated translations (edited .po files).

All commands should be run from the /isa subfolder.

1. Add or edit translatable text in source code

Mark new strings to be translated using formats shown below:

  • Templates: _('')
  • Python: gettext('')

2. Extract strings to .pot file

run pybabel extract -F babel.cfg -o messages.pot --input-dirs=. This step is only needed after changes have been made to translatable text in the source code in step 1.

3a. Update .po files

run pybabel update -i messages.pot -d translations -l <lang_code> Use this command to update .po files for each supported language.

It will merge in any new strings found in the .pot file generated in step 2. Any strings that are no longer found are placed at the bottom of the file, using commented out lines beginning with #~

3b. Create new .po file

run pybabel init -i messages.pot -d translations -l <lang_code> Use this command to create a new .po file.

This step is only needed when adding a new supported language. Commit the new .po file to source control.

4. Add new translations

Add the actual translated text for each language to the corresponding .po file located at isa/translations/<lang_code>/LC_MESSAGES/messages.po

This step should be completed by translators, so can happen at any time. Commit any changes to .po files to source control.

5. Compile final .mo file

run pybabel compile -d translations Once translations are ready from step 4 (or from pulling changes with updated .po files), you need run the compile command before seeing the new translations in the app.

Testing the application

  • To run tests from the applications root directory, use the command nose2 -v tests.<test_module_name>

  • To get a blueprint's coverage, run following commands:

    • From the applications root directory, run coverage run -m unittest discover
    • Then run coverage report -m isa/<blueprint_name>/*.py>

labs-tools-isa's People

Contributors

ammarpad avatar eugeneegbe avatar gabrielchl avatar mahuton avatar navino-evans avatar sanyam-git avatar seanmcbirnie avatar sebastian-berlin-wmse avatar somechris avatar translatewiki avatar zhuyifei1999 avatar

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.