Problem/Motivation

On #2546212: Entity view/form mode formatter/widget settings have no translation UI and/or #2449597: Number formatters: Make it possible to configure format_plural on the formatter level I noticed that if you go to translate an Integer field, you do not get the option to translate the Prefix and Suffix fields. They definitely need to be translatable.

The problem is that they are config type "string" and it should be "label". This is in core/config/schema/core.data_types.schema.yml :

field.field_settings.integer:
  type: mapping
  label: 'Integer'
  mapping:
...
    prefix:
      type: string
      label: 'Prefix'
    suffix:
      type: string
      label: 'Suffix'

See also #2545730: Misuse of formatPlural() in Numeric field prefix/suffix

Proposed resolution

Change prefix/suffix to be type "label" instead. This should apply to all fields that have prefix/suffix.

Remaining tasks

Make a patch.

User interface changes

Prefix/suffix settings for numeric fields will be translatable.

API changes

None.

Data model changes

Not really. This is a compatible change -- the only difference between string and label is that label is marked as Translatable. So I don't think we need to migrate anything.

CommentFileSizeAuthor
#3 prefix-suffix-type-2546356-2.patch1.02 KBpravin ajaaz

Comments

jhodgdon created an issue. See original summary.

jhodgdon’s picture

Issue summary: View changes
pravin ajaaz’s picture

StatusFileSize
new1.02 KB

Changed the type for prefix/suffix as "label". They are available in "Integer, Float and decimal"

pravin ajaaz’s picture

Status: Active » Needs review
alx_benjamin’s picture

Was uploading the same patch. You beat me to it :)

Changing status to Needs Review

-------------------------------------------------
Sponsored by http://reallifedesign.co.uk/

merilainen’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. I tested this on a vanilla Drupal8. Without the patch I can see the prefix and suffix strings which I have entered only in the UI translation list, but this is way better because now I can translate the prefix and suffix per field instance.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed c65d6df and pushed to 8.0.x. Thanks!

  • alexpott committed c65d6df on 8.0.x
    Issue #2546356 by Pravin Ajaaz: Numeric field prefix/suffix settings...
jhodgdon’s picture

pravin ajaaz’s picture

Status: Fixed » Closed (fixed)

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