Frontend: Fix system locale detection.

The locale detection would crash if no OCR tools are available, or if
system locale cannot be determined (i.e. LANG env var is not set)

The bug is also present in stable, but it's a pretty minor issue, so no need to backport the fix IMHO.