Bug report #17395

Fields of memory layers are renamed automatically by the translation

Added by Georg Wicke about 7 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider
Affected QGIS version:2.14.3 Regression?:No
Operating System:Ubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:no timely feedback
Crashes QGIS or corrupts data:No Copied to github as #:25292

Description

Steps to reproduce

Requires the german version of QGIS.

1. Create a vector memory layer through PyQGIS
2. Add a field named "id" via the dataProvider of the layer
3. Add the layer to the registry
4. Open the attribute table

Expected behaviour: A column named "id" is visible.

Observed behaviour: The column is named "Objektkennung". The actual field name is changed, too - e. g. if a script accesses a feature's attribute through `feature["id"]`, a KeyError is raised. The script has to use the field id instead to work consistently across machines.

This is quite dramatic, as it may unexpectedly wreck a lot of scripts and plugins that "work just fine" for the developer.

History

#1 Updated by Jürgen Fischer almost 6 years ago

  • Status changed from Open to Feedback

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#2 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to no timely feedback
  • Status changed from Feedback to Closed

Also available in: Atom PDF