python pages
- A powerset generator in python - How to generate a powerset in a memory effecient way in python using generators
- Automatically translating a gettext-ed programme with Apertium - Using the open source machine translating software apertium you can automatically translate your gettext/.po files to the target language to bootstrap your translations
- Convert text to Pirate Talk in Python - AAARRR! How to speak like a pirate with python
- Dynamically watching for missing imports with pylint -
- Find mistakes in Django i18n templates - I frequently make mistakes when i18n-ing a django website, making loads of little syntax errors, Here's a script to find some of these little mistakes
- Galea - Merge video clips into 1 video with transitions - Galea is a simple command line tool in the unix tradition, it does one thing, and that's to merge a collection of videos into 1 video, with a short transition/wipe between them. Ideal for making a compilation clip
- How to add a "English (Pirate)" language option on your website - A properly internationalized website or programme can take different languages, this explains how to automatically make a speak like a pirate option to your language choice
- How to find missing _/gettext import statements - Using pylint to find places in your python or django project where you forgot to import django.utils.translation.ugettext
- Lint tool to find non-i18n strings in a django template - Finds text in a Django template that has not been passed through 'trans' or 'blocktrans'. If you are tying to internationalize a django template, this linter is invaluable to make sure you don't miss any bits.
- Manually activating a language to translate to in Django - Temporarily switch the language that django's translation framework uses to a manually choosen one
- Mocking gettext with Django Translations to test that your code is translating - I wanted to test that a function was translating text, however I had no translations done. Django would fall back to english, so I had no way to know if it was translating or not. By hacking the django objects, I was able to mock a translation.
- Pylint plugin to find non-i18n/gettext strings - This is a plugin for pylint, the python static code analyzer (lint) that finds strings that are not passed through _/gettext. Use this checker to find strings which you have forgotten to translate
- Python Tips & Tricks -
- Refresh a Django object from the database -
- Start the python debugger at any line -
- What parts of a string don't match a regex? - Finding what part of a string doesn't match a regular expression using python
- i18n django middleware to check for ugettext_lazy strings in byte strings - If you put a ugettext_lazy call into a byte string (as opposed to a unicode string), you get a string instead.