public function testGets() { $vm_ret = $this->opt_object->get('ca_objects.type_id', array('convertCodesToDisplayText' => true)); $this->assertEquals('Image', $vm_ret); // it should get the en_US title here because at this point this is our "UI locale" $vm_ret = $this->opt_object->get('ca_objects.preferred_labels'); $this->assertEquals('My test image', $vm_ret); // extract de_DE locale from array $vm_ret = $this->opt_object->get('ca_objects.preferred_labels', array('returnWithStructure' => true, 'returnAllLocales' => true)); $this->assertInternalType('array', $vm_ret); $va_vals = array_shift(array_shift(caExtractValuesByLocale(array('preferred' => array('de_DE')), $vm_ret))); $this->assertEquals('Testbild', $va_vals['name']); // it should get the en_US title here because at this point this is our "UI locale" $vm_ret = $this->opt_object->get('ca_objects.nonpreferred_labels'); $this->assertEquals('Alternative title for test image', $vm_ret); // extract de_DE locale from array $vm_ret = $this->opt_object->get('ca_objects.nonpreferred_labels', array('returnWithStructure' => true, 'returnAllLocales' => true)); $this->assertInternalType('array', $vm_ret); $va_vals = array_shift(array_shift(caExtractValuesByLocale(array('preferred' => array('de_DE')), $vm_ret))); $this->assertEquals('Alternativer Titel für Testbild', $va_vals['name']); }
function caExtractValuesByUserLocale($pa_values, $ps_item_locale = null, $pa_preferred_locales = null, $pa_options = null) { return caExtractValuesByLocale(caGetUserLocaleRules($ps_item_locale, $pa_preferred_locales), $pa_values, $pa_options); }