carbon icon indicating copy to clipboard operation
carbon copied to clipboard

Overriding i18n strings requires original typing that can't be changed

Open phil9690 opened this issue 1 year ago • 2 comments

Current behaviour

When trying to override locales by following https://carbon.sage.com/?path=/docs/textarea--character-limit-story, the original typing is still being enforced causing type errors in my implementation. E.g. my override only needs to pass in count for this https://github.com/Sage/carbon/blob/master/src/locales/locale.ts#L24-L26, but I get the error that formattedCount is required.

Expected behaviour

Custom implementation of Carbon locales should not require the original typing.

CodeSandbox or Storybook URL

n/a

JIRA Ticket (Sage Only)

No response

Suggested Solution

No response

Carbon Version

123.9.0

Design Tokens Version

No response

What browsers are you seeing the problem on?

Firefox, Chrome, Safari, Microsoft Edge

What Operating System are you seeing the problem on?

MacOS

Anything else we should know?

No response

Confidentiality

  • [X] I confirm there is no confidential or commercially sensitive information included.

phil9690 avatar Jan 15 '24 17:01 phil9690

We could probably update the type it's recursively partial as currently it only sets the first level to be so

type RecursivePartial<T> = {
  [P in keyof T]?: RecursivePartial<T[P]>;
};

edleeks87 avatar Jan 16 '24 13:01 edleeks87

FE-6333

tomdavies73 avatar Jan 16 '24 14:01 tomdavies73

Following the changes made in Carbon v137.0.0 whereby translations are provided by Carbon, I do not believe there is any issue outstanding here now. I am going to close this issue with this in mind.

nineteen88 avatar Aug 23 '24 13:08 nineteen88