Brew Gettext



  • Homebrew’s package index. GNU internationalization (i18n) and localization (l10n) library.
  • Installing QGIS 3. To install the last version of QGIS 3 you just have to run in your terminal brew install qgis.Running this command in your terminal you download and install a precompiled bottle of QGIS 3 build with most of the available options. Check below the options with the bottle is build.
  1. Brew Install Gettext Link
  2. Brew Link Gettext
  3. Brew Uninstall Gettext
  4. Brew Gettext

To install the last version of QGIS 3 you just have to run in your terminal brew install qgis. Running this command in your terminal you download and install a precompiled bottle of QGIS 3 build with most of the available options. Check below the options with the bottle is build.

Install your RubyGems with gem and their dependencies with brew. “To install, drag this icon” no more. Homebrew Cask installs macOS apps, fonts and plugins and other non-open source software. $ brew install-cask firefox. Making a cask is as simple as creating a formula. I tried running this brew link gettext -force, but I was getting: $ brew install gettext Warning: gettext 0.20.2 is already installed and up-to-date To reinstall 0.20.2, run `brew reinstall gettext` $ brew link gettext -force Warning: Refusing to link macOS provided/shadowed software: gettext If you need to have gettext first in your PATH run.

  • --with-3d: Build with 3D Map View panel
  • --with-gpsbabel: Build with GPSBabel. Read, write and manipulate GPS waypoints in a variety of formats
  • --with-grass: Build with GRASS 7 integration plugin and Processing plugin support (or install grass-7x first)
  • --with-lastools: Build with LAStools, efficient tools for LiDAR processing. Contains LASlib, a C++ programming API for reading / writing LIDAR data stored in standard LAS format.
  • --with-orfeo: Build extra Orfeo Toolbox for Processing plugin
  • --with-qspatialite: Build QSpatialite Qt database driver
  • --with-r: Build extra R for Processing plugin
  • --with-saga: Build extra Saga GIS (LTS) for Processing plugin
  • --with-server: Build with QGIS Server (qgis_mapserv.fcgi)
  • --with-taudem: Build with TauDEM, Terrain Analysis Using Digital Elevation Models for hydrology
  • --with-whitebox: Build with Whitebox Tools, an advanced geospatial data analysis platform

The options --with-mssqland --with-oraclearen’t implemented at the moment because the user needs to accept licenses before building with them and it would complicate too much the building process of the bottle. --with-postgresql10, --with-api-docs and --with-isolation are left to the end user consideration because we consider seldom used options or features.

Brew

Anyhow, if you are interested in any of those options to be included or dropped from the default build of QGIS 3, please let us know why opening an issue.

qgis-res

We are using this formula to speed-up the QGIS’s installation and update processes and, in consequence, is one of the main dependencies of QGIS. This way you can have more Python modules available to use with QGIS and since this modules are seldom updated it saves installation and updating time.

When qgis-res formula is installed or updated, and since QGIS is build now by default --with-r, it will install R from Homebrew-core.

R from core vs R from other taps

If you have installed R from other tap —from sethrfore/r-srf for instance— instead of R from core the install will ask you to uninstall it to continue. You have two options.

  1. You can just uninstall your version of R and continue with QGIS 3 install. When the QGIS 3 install finish you just rever. You uninstall R from core and install again your preferred version.

  2. You just can rename the keg in your cellar before you start the install or update of QGIS 3 and when it finish you rever your changes and relink the formula. Something like the bellow code will do the trick.

Please note that you have to do this even if you have your preferred tap pinned, since the pinned tap formulae only take preference when the formula is called by you, not when it’s installed as dependency.

Recommendations, issues, caveats and headaches

You can come across the following problems.

Formulae renaming & tap pinning

We are pondering renaming some formulae to take the same name of their counterpart on core. The main rationale behind this is to avoid to have two versions or kegs of the same software in your machine. However, this could bring problems in, since Homebrew take precedence other core formulae when installing dependencies, even when the tap is pin with brew tap-pin <tap-name>. Formulae from pinned taps only take precedence when you install those formulae from terminal.

Anyhow we recommend you to pin this tap, while we try to figure out this conundrum. We encourage you to give your opinion.

The maximum number of open file descriptors

Since the build of QGIS 3 has a lot of dependencies you perhaps could run into an error related to the lack of resources allocated to the shell. Luckily you can change that using the command ulimit. Check if ulimit -n is bigger than 1024 and it it’s not set it ulimit -n 1024 . It’s up to you if you want to reset to you previous limit after you build or install QGIS.

Post-install could not finish

It seems that there was a small change in OTB, I will correct it in the next release of QGIS.You can solve this by temporarily renaming OtbUtils file.

Fixing dependencies

Sometimes errors installing or building are related to incorrect installed or linked dependencies. We recommend you to do the following and try to build or install again:

Remove the cache

and the temporary files in /tmp related to the build if any.

A failed installation perhaps has build qgis_customwidgets.py you need to delete it.

Reinstall a relink some dependencies:

Mind the CI

Build status:

You have to keep in mind that if the bottle is able to build in our building server —aka CI— and it isn’t able to to build or install in your machine, the problem is probably related to your local environment. We can help, but we don’t promise anything. You can check the state of the build on the readme file, but you have to keep in mind, also, that some times the state is marked as failed by an error unrelated to the build, but to the deployment. Usually it can’t upload the bottles to the bottle server and we upload them manually.

Question or problem about Python programming:

I am trying to translate a string.

to…

My settings.py file has this:

And I am getting this:

I also don’t understand this error message.

The docs: https://docs.djangoproject.com/en/1.6/ref/django-admin/#django-admin-makemessages

And for bonus upvotes, a related question:
gettext wasn’t linked when I installed it… Any help with this one? Should I force it?

Thanks!

UPDATES:

I have since changed the name of translations to locale and updated my settings.py accordingly. then I ran this again and it’s still complaining about gettext:

I also found this:

Understand homebrew and keg-only dependencies

Gettext

after reading this:

How to solve the problem:

Solution 1:

After making sure I had this in settings:

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):

And BAM. I’ve got my po file.

But the doctor says:

Solution 2:

Please try this in Ubuntu

sudo apt-get install gettext

And use brew install gettext in OSX

Also make sure to set the local path in settings.py file.

Solution 3:

Here is the solution for those having problems with translations or are creating a multi-language site for the very first time in Django. Here is the way I do it, and I have been doing since Django 1.4, below is tested in 1.7.1:

In settings.py …

Add to MIDDLEWEAR_CLASSES, locale, it enables language selection based on request:

Add LOCALE_PATHS, this is where your translation files will be stored, also enable i18N:

Set LANGUAGES that you will be translating the site to:

Add i18n template context processor, requests will now include LANGUAGES and LANGUAGE_CODE:

Nest, in urls.py :

In url_patterns, add the below, it will enable the set language redirect view:

See Miscellaneous in Translations for more on this.

Add the following imports, and encapsulate the urls you want translated with i18n_patterns. Here is what mine looks like:

Note: You can also drop your admin urls into the i18n_patterns.

Now anywhere you use text and want to convert it, import lazytext and wrap every string with it like so _(‘text’), you can even go to your other urls.py files and do url translation like so:

You can wrap text that you want translated in your other files, such as models.py, views.py etc.. Here is an example model field with translations for label and help_text:

Django translation docs are great for this!

In your html templates…

Now you can go into your templates and load the i18n templatetag and use trans and transblock on the static stuff you want to translate. Here is an example:

Now run a makemessages for each of your locales:

And now all is left is to go into your /locales folder, and edit each of the .po files. Fill in the data for each msgstr. Here is one such example of that:

And finally compile the messages:

There is a lot more to learn with translations and internationalization is closely related to this topic, so check out the docs for it too. I also recommend checking out some of the internationalization packages available for Django like django-rosetta, and django-linguo. They help translate model content, django-rosetta does not create new entries for this in your database, while django-linguo does.

If you followed this you should be off to a good start. I believe this is the most standardized way to get your site running in multiple languages. Cheers!

Solution 4:

For Mac users brew link gettext --force can be risk, as Brew advises. A better work around is to set a new PATH variable for your virtual environment. So, in the postactivate file, which is located in the bin folder of your virtual environment folder, type:

Note that you have to replace 0.19.7 by the version that is installed in your machine.

And in your predeactivate file, which is located in the same folder of postactivate file, type:

Now you can use the python manage.py makemessages -l <desired_language> without worries. 🙂

Cheers.

Solution 5:

For macOS :

brew install gettext
export PATH='/usr/local/opt/gettext/bin:$PATH'

Solution 6:

Please install gettext in your ubuntu OS
using sudo apt-get command

Or in Mac

using brew command

Solution 7:

Have you added {% load i18n %} to the top of your template?

Bonus: You don’t need to link gettext, what is the output from brew doctor?

Solution 8:

If you don’t want to link gettext (which you shouldn’t because messing about with OS X internals is bad) then you can set the PATH for the makemessages command. The following should work (but you need to adjust your gettext version number):

If you do it that way your installed gettext remains keg-only and django-admin will be happy and find all the programms it needs.

Solution 9:

Brew Uninstall Gettext

One of the possibilities is that after you have successfully done all the above and done

you may have improperly configured your IDE or venv. In order to bypass this, go to the command prompt, navigate to your root folder and run py manage.py makemessages from there. It will work.

Brew Gettext

Hope this helps!