This is a sub-issue of #1910624: [META] Introduce and complete configuration schemas in all of core.

Problem/motivation

#1866610: Introduce Kwalify-inspired schema format for configuration introduced the idea of config schema. The changelog leads to (hopefully extensive) documentation on the format at http://drupal.org/node/1905070. While there are little cleanups planned for the format overall, the current format is a result of months of back and forths, so it should be perfectly fine to apply it more widely to core.

Proposed solution

Create a configuration schema for locale module.

Schema in place

Schema not yet in place
locale.settings.yml

Files: 
CommentFileSizeAuthor
#10 1919180-locale-schema-10.patch1.55 KBsandipmkhairnar
PASSED: [[SimpleTest]]: [MySQL] 52,955 pass(es). View
#10 1919180-diff-7-10.txt1.55 KBsandipmkhairnar
#10 lacale-schema-form.png46.37 KBsandipmkhairnar
#7 1919180-locale-schema-7.patch1.58 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 52,645 pass(es). View
#5 1919180-locale-schema-5.patch1.58 KBvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 52,458 pass(es). View
#3 1919180-locale-schema-3.patch2.53 KBvijaycs85
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1919180-locale-schema-3.patch. Unable to apply patch. See the log in the details link for more information. View
#2 1919180-locale-schema.png26.64 KBsandipmkhairnar
#2 1919180-locale-schema-2.patch1.58 KBsandipmkhairnar
PASSED: [[SimpleTest]]: [MySQL] 52,195 pass(es). View
#1 1919180-locale-schema-1.patch965 bytesvijaycs85
PASSED: [[SimpleTest]]: [MySQL] 50,762 pass(es). View

Comments

vijaycs85’s picture

Status: Active » Needs review
FileSize
965 bytes
PASSED: [[SimpleTest]]: [MySQL] 50,762 pass(es). View

Adding schema file...

sandipmkhairnar’s picture

FileSize
1.58 KB
PASSED: [[SimpleTest]]: [MySQL] 52,195 pass(es). View
26.64 KB

updating schema as per code style in http://drupal.org/node/1905070#codestyle and verified in config_inspectorschema form

vijaycs85’s picture

FileSize
2.53 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1919180-locale-schema-3.patch. Unable to apply patch. See the log in the details link for more information. View

Removing existing schema file and minor comment update.

Status: Needs review » Needs work

The last submitted patch, 1919180-locale-schema-3.patch, failed testing.

vijaycs85’s picture

Status: Needs work » Needs review
FileSize
1.58 KB
PASSED: [[SimpleTest]]: [MySQL] 52,458 pass(es). View

Updating right patch file...

guy_schneerson’s picture

Status: Needs review » Needs work

@vijaycs85 Looks great no syntax / Code style issues.

I am not over familiar with all the settings but all but one label look sensible.

The only change I would make is change "Strings cached" to "Cache strings".

vijaycs85’s picture

FileSize
1.58 KB
PASSED: [[SimpleTest]]: [MySQL] 52,645 pass(es). View

Thanks @guy_schneerson. Updated label.

vijaycs85’s picture

Status: Needs work » Needs review
guy_schneerson’s picture

Status: Needs review » Needs work

Hi @vijaycs85 thanks for the updated patch.
I have reviewed all the settings and looked at the code implementing them to make sure they describe what they do.
I have located one more issue with the overwrite_customized & overwrite_not_customized.
Those don't match the UI code and don't match the implementation as far as I can see, I actually think the UI code is incorrect and will raise a separate issue.

According to the local PoDatabaseWrite.php

* - not_customized: boolean indicating that not customized strings should
* be overwritten.
* - customized: boolean indicating that customized strings should be
* overwritten.

and according to Gettext.php

'customized': Flag indicating whether the strings imported from $file
* are customized translations or come from a community source.

I think the safest approach is to go with

<?php
        overwrite_customized:
          type: boolean
          label: 'Overwrite customized translations'
        overwrite_not_customized:
          type: boolean
          label: 'Overwrite non customized translations'
?>
sandipmkhairnar’s picture

FileSize
46.37 KB
1.55 KB
1.55 KB
PASSED: [[SimpleTest]]: [MySQL] 52,955 pass(es). View

Thanks @guy_schneerson for comments. Updated patch as per comment.

schema form

vijaycs85’s picture

Status: Needs work » Needs review
guy_schneerson’s picture

Status: Needs review » Needs work

Thanks @vijaycs85 looks good will give it another proper test tomorrow I also posted a related issue Configuration of Import behavior may be unclear / incorect I don't think it directly relates to this patch at the moment as the new labels take a "safe" approach.

guy_schneerson’s picture

Status: Needs work » Reviewed & tested by the community

Looks good to me.
We have one potential small issue where all the settings under the "translation" section are all related to the "translation import" but that may be coincidental and other settings may be added to this section in the future.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x, thanks! I'll push once testbot has caught up a bit.

Automatically closed -- issue fixed for 2 weeks with no activity.

rych’s picture

I've found an item in locale.settings.yml, but it doesn't appear in schema file.
Related issue: Complete Configuration schemas for locale module