“gettext()” vs “gettext_lazy()” in Django

gettext() vs. gettext_lazy() In definitions like forms or models you should use gettext_lazy because the code of this definitions is only executed once (mostly on django’s startup); gettext_lazy translates the strings in a lazy fashion, which means, eg. every time you access the name of an attribute on a model the string will be newly … Read more

How to use gettext with python >3.6 f-strings

‘Hey {},’ is contained in your translation dictionary as is. If you use f’Hey {username},’, that creates another string, which won’t be translated. In that case, the format method remains the only one useable, but you could approach the f-string features by using named parameters _(‘Hey {username},’).format(username=username) or if you have a dictionary containing your … Read more

What good alternatives to Poedit are there? [closed]

Here are some good alternatives to Poedit: Translation editors Lokalize: for KDE users (KBabel is now obsolete). GTranslator: for GNOME users. GTeddead link: runs everywhere Eclipse runs. Virtaal: Windows, Linux, Mac. Good choice for GNOME users. Text editor Vim: you can use the Vim script for po files Editing Emacs: you can use po mode … Read more

PHP using Gettext inside

As far as I can see in the manual, it is not possible to call functions inside HEREDOC strings. A cumbersome way would be to prepare the words beforehand: <?php $world = _(“World”); $str = <<<EOF <p>Hello</p> <p>$world</p> EOF; echo $str; ?> a workaround idea that comes to mind is building a class with a … Read more

django-admin.py makemessages not working

After making sure I had this in settings: LOCALE_PATHS = ( os.path.join(BASE_DIR, ‘locale’), ) print(LOCALE_PATHS) I double checked I had the locale directory in the right place with its name spelled correctly. I ended up linking gettext (after asking about that on superuser): brew link gettext –force manage.py compilemessages django-admin.py makemessages -l es And BAM. … Read more

Is there any git hook for pull?

The githooks man page is a complete list of hooks. If it’s not on there, it doesn’t exist. That said, there is a post-merge hook, and all pulls include a merge, though not all merges are pulls. It’s run after merges, and can’t affect the outcome. It never gets executed if there were conflicts; you’d … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)