Closed (fixed)
Project:
Salsa Entity
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Feb 2013 at 08:48 UTC
Updated:
12 May 2015 at 15:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
berdirComment #2
berdirNote: #2108347: Adding Salsa-Translation support already added an initial mapping, although we might want to extend it here and make it configurable as suggested.
Comment #3
s_leu commentedAlright here's a first patch. I also included a renaming of the wrong used ISO standards in the language mapper class.
Comment #4
s_leu commentedAdded a variable_get as condition in the presave hook as proposed in the issue description.
Comment #5
berdirShould a) only change if the entity is new (no supporter_KEY) and Language_Code is currently empty. We don't want to affect code that re-saves supporters or sets the language code explicitly.
Comment #6
s_leu commentedAdded another possibility to override language code mapping with custom variable and added the mentioned conditions in the presave hook.
Comment #7
s_leu commentedComment #8
s_leu commentedHere the correct interdiff
Comment #9
s_leu commentedFound some more usages of the wrong iso code identifier in variable names and function docs. Also changed the @file description of the language mapper file.
Comment #10
s_leu commentedFound further occurrences of the wrong code...
Comment #11
s_leu commentedAdded hidden field in single target action forms to provide supporter language there.
Comment #12
s_leu commentedFound that german had the wrong iso-639-2 code. Also removed unecessary passing of global language.
Comment #14
LukyLuke_ch commentedThe code looks good for me.
Due to the last change from 'deu' to 'ger' the test fails.
This should be corrected as well ;)
Comment #15
s_leu commentedDidn't realize that there was a test for this. This patch was green on my machine.
Comment #16
LukyLuke_ch commentedLooks good now for me.
Comment #17
berdirStrange, how can this be working now for translations? I just confirmed and it is really ger.
You can also implement hook_salsa_supporter_presave() directly, saves you one check and doesn't invoke the hook when it's not necessary.
Given that this is pretty crucial and we want to make sure that it doesn't mess up existing data, can we add a basic test for this, you can test 3 scenarios:
a) Save a supporter with the setting disabled, shouldn't set a langcode.
b) Save a supporter with the setting enabled, should set the correct langcode (just making sure that the site default is set is enough, we don't need to test multiple languages)
c) Save a supporter that already has a langcode set and setting enabled, must not overwrite the existing value.
You can do this by testing the API directly, create supporter entities and save them.
Comment #18
s_leu commentedOk i applied to proposed improvements including the demanded test.
Comment #19
berdirComitted.