Skip to content

Returned result of layer_property (layer, 'type') is dependent of UI language #65009

Description

@matthieumuller

What is the bug or the crash?

Running layer_property (layer, 'type') in a QGIS expression returns a different string result depending on the language selected in QGIS.

This make expression very prone to breakage, eg: I am developing an expression on a machine in American English, and my users experience bugs because their machine are in another language.

Example:

  • In English layer_property (layer, 'type') returns 'Vector'
  • In French layer_property (layer, 'type') returns 'Vecteur'
Image Image

Steps to reproduce the issue

  • Go to Settings > Options
    • In the General tab: check "Override System Locale"
    • Set the field "User Interface Translation" to "American English"
  • Restart QGIS for the option to take effect
  • Create a new project
  • Create a layer, eg: Layer > Create Layer > Create Shapefile layer
  • Open the expression builder, eg: Edit > Select > Select Features by expression
  • Set the text to layer_property (@layer, 'type'), this should output 'Vector'
  • Repeat these steps but select "français" instead of "American English" in the Settings
  • layer_property (@layer, 'type') should output 'Vecteur'

Versions

QGIS version3.40.11-Bratislava
QGIS code revisiondf059ed19c8
 
Libraries
Qt version5.15.8
Python version3.11.2
GDAL version3.6.2
PROJ version9.1.1
EPSG Registry database versionv10.076 (2022-08-31)
GEOS version3.11.1-CAPI-1.17.1
SQLite version3.40.1
PostgreSQL client version15.14 (Debian 15.14-0+deb12u1)
SpatiaLite version5.0.1
QWT version6.1.4
QScintilla2 version2.13.3
OS versionDebian GNU/Linux 12 (bookworm)
 
Active Python plugins
grassprovider2.12.99
MetaSearch0.3.6
db_manager0.1.20
processing2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEither a bug report, or a bug fix. Let's hope for the latter!ExpressionsRelated to the QGIS expression engine or specific expression functions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions