- ๐ง๐ชBelgium joevagyok
None of the above proposed patches offer the right solution here, by hardcoding a maxlength number on the translation form element.
Since config_translation is not aware of the form used for the given config, it relies on a basic mapping between config types and field elements.
Therefore, config_translation has no idea about the fact that in the parent issue โ , maxlength was set to 255. Thelabel
config type is mapped toDrupal\config_translation\FormElement\Textfield
which uses the default 128 char maxlength setting.So either we change the slogan config type from
label
totext
which will allow more characters on translation too, or come up with way to set core from Element properties within config_translation per field.As a workaround, developers can make their own class and change the mapping to override the
Drupal\config_translation\FormElement\Textfield
class to their own class where they set all desired properties to the Textfield element. - First commit to issue fork.
- Merge request !6432issue:3176880 Increase site slogan maxlength for the translations fixes โ (Open) created by shalini_jha
- Status changed to Needs review
about 1 year ago 1:06pm 2 February 2024 - ๐ฎ๐ณIndia shalini_jha
HI, I think the one of solution to this problem is updating the config schema. Currently, these 2 field name,slogan use type: label, where long texts should be marked as type: text , so i have added text type for slogan field. please clear your cache after these changes.
I have added a MR for your reference, please review. - Assigned to dishakatariya
- Status changed to Needs work
about 1 year ago 8:17pm 2 February 2024 - ๐บ๐ธUnited States smustgrave
Schema changes will require an update hook. If the solution is changing issue summary should reflex.
Even as a task seems like something that will need test coverage.
- Issue was unassigned.
- Status changed to Needs review
about 1 year ago 8:58am 6 February 2024 - ๐ฎ๐ณIndia shalini_jha
After the system.site schema changes(type:labe to type:text)for slogan field, I tested the Translations for System information add/edit form, and it seems that the slogan field is accepting more characters than intended. Subsequently, I also tested the existing value, and it remains unchanged. Additionally, when I added a translation for the slogan field, those changes did not take effect. Therefore, it appears that the data is not being affected by these modifications.
Can you please do we need hook update for this ?It appears that the test case named testSourceValueDuplicateSave is encountering a failure, at the line:
$this->assertSession()->pageTextNotContains('FR ' . $site_slogan);
The purpose of this line is to confirm that the original value remains unchanged when a translation is added. Despite the presence of these translated text for both the name and slogan fields in the translation edit page, the test is passing (refer to the attached screenshot). My assumption is that if the slogan field type were a label, the pageTextNotContains function might not have checked the slogan field value. However, due to recent changes made to the slogan field type, the pageTextNotContains function is now taking the slogan field value also, resulting in the test failure.
To resolve this issue, I adjusted the line related to the slogan field. Instead of using pageTextNotContains, I opted for elementTextNotContains. The revised line is as follows:
$this->assertSession()->elementTextNotContains('css', '#edit-source-config-names-systemsite-slogan', 'FR ' . $site_slogan);
With these modifications, the test case is now working as intended, ensuring that the original value of the slogan field remains unaffected by the addition of a translation.
so can i update these changes for test fail.Please review and suggest . thanks
- ๐ฌ๐งUnited Kingdom catch
@shalini_jha it looks like you didn't push to the MR?
- Status changed to Needs work
about 1 year ago 8:21pm 6 February 2024 - Status changed to Needs review
about 1 year ago 5:03am 7 February 2024 - ๐ฎ๐ณIndia shalini_jha
I have pushed the changes in https://git.drupalcode.org/project/drupal/-/merge_requests/6432. please review
- Assigned to dishakatariya
- Issue was unassigned.
- Status changed to RTBC
about 1 year ago 7:47am 7 February 2024 - ๐ฎ๐ณIndia dishakatariya
Hi, Verified and tested the Merge request !6432 on 11.x-dev version. Its working as expected now.
Testing Steps:
1. Install the 11.x-dev version
2. Go to the Extend and enable the Languages module
3. Enable the translation module.
3. Now go to the /admin/config/regional/language/add and add any language.
3. then, Go to '/admin/config/system/site-information/translate' and try to set a longer slogan.
4. Now you will be able to see the error for the slogan added 255 characters long. and not able to add the translation.
5. Now, Apply the patch.
6. and Check if the maxlength is added and can be able to save translation slogan.
Testing Results-
Increased site slogan maxlength for the translations.
Attaching screenshots for the reference.
Can be move to RTBC.
Thanks! - Status changed to Needs work
about 1 year ago 8:56am 7 February 2024 - Status changed to Needs review
about 1 year ago 12:56pm 7 February 2024 - Status changed to Needs work
about 1 year ago 12:58pm 7 February 2024 - ๐ง๐ชBelgium joevagyok
Left another review on the code, please make sure to load up the config to check the string is correctly saved, beside asserting the success message.