pnp / sp-dev-site-scripts

Repository for sample SharePoint site designs and site scripts
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview
MIT License
162 stars 68 forks source link

DisplayName not "regionalized" when using addSPField verb #28

Open AndersRask opened 5 years ago

AndersRask commented 5 years ago

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.

Category

Expected or Desired Behavior

Adding a list with fields using site script verbs createSPList and addSPField and PowerShell on an existing site with non-english regional settings (LCID 1030 in this case). When site is created, the displayName of the fields should behave just like an addSPFieldXml: the displayName should be added to all languages.

Observed Behavior

The displayName field only seems to be visible for en-US language. The other languages (eg if you have a browser with danish regional settings) show internalName. I confirmed this by exporting translations XML for the sites: the "value" XML element contains the displayName only in the .en-US.resx file. In all other .resx files fields created with addSPField are showing internalName, but fields created with addSPFieldXml shows correct DisplayName value from Field xml value.

Steps to Reproduce

If you are reporting a bug please describe the steps to reproduce the bug in sufficient detail to allow testing. Only way to fix things properly, is to have sufficient details to reproduce it. If you are making a suggestion, you can delete this section.

Submission Guidelines

Use PowerShell to add a site design with the above site script Use PowerShell to invoke the site design on a non-english site collection for example Danish/1030 (not sure this step is necessary) Observe field names are internal for non-english browsers, or simply export translations for English and Danish and observe the different behaviour: fields created with addSPField use displayName only in English resx, other languages use internalName, but for addSPFieldXml they are shown correctly for all languages.

Example JSON (subset):

...
{
          "displayName": "Ekstern support",
          "internalName": "Doksys_Eksternsupport",
          "isRequired": false,
          "addToDefaultView": true,
          "fieldType": "Note",
          "enforceUnique": false,
          "verb": "addSPField"
        },
        {
          "verb": "addSPFieldXml",
          "schemaXml": "<Field Type=\"URL\" DisplayName=\"Driftsvejledning\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Format=\"Hyperlink\" StaticName=\"Doksys_Driftvejledning_link\" Name=\"Doksys_Driftvejledning_link\" />"
        }
...

Example from en-US.resx with both correct value for "Ekstern support" and "Driftvejledning": <data name="4cd084bb64214a9e9f2c3ee933b7512e_FieldTitleDoksys_Driftvejledning_link"><value>Driftsvejledning</value><comment>Single line of text</comment></data><data name="4cd084bb64214a9e9f2c3ee933b7512e_FieldTitleDoksys_Eksternsupport"><value>Ekstern support</value><comment>Single line of text</comment></data>

Example from da-DK.resx with incorrect value for "Ekstern support" but correct for "Driftvejledning": <data name="4cd084bb64214a9e9f2c3ee933b7512e_FieldTitleDoksys_Driftvejledning_link"><value>Driftvejledning</value><comment>Single line of text</comment></data><data name="4cd084bb64214a9e9f2c3ee933b7512e_FieldTitleDoksys_Eksternsupport"><value>Doksys_Eksternsupport</value><comment>Single line of text</comment></data>