unchained icon indicating copy to clipboard operation
unchained copied to clipboard

Filter options Localization support

Open Mikearaya opened this issue 1 year ago • 6 comments

Currently, it's not possible to create a localized filter option

input CreateFilterOptionInput {
      value: String!
      title: String!
    }

its always using locale from the context but it should be possible to override this when required

  const filter = await modules.filters.createFilterOption(
    filterId,
    { ...option, locale: context.localeContext.language },
    context,
  );

Mikearaya avatar May 04 '24 17:05 Mikearaya

Using the locale only from the context is just fine, it will ensure that the selected language i'm usually seeing is used which is also a supported language and primarily the default language when creating a new option or any other entity.

If we'd change this, we'd need to enable this for all other "Create Text Input Types" for ex. CreateProductVariationInput, CreateProductVariationOptionInput, CreateProductInput, CreateAssortmentInput.

To add another localized string to an option it's this here with providing the filterOptionValue (UpdateFilterTextInput has locale):

 """
      Updates or created specified filter texts for filter with ID provided and locale and optionally filterOptionValue
      """
      updateFilterTexts(
        filterId: ID!
        filterOptionValue: String
        texts: [UpdateFilterTextInput!]!
      ): [FilterTexts!]!

pozylon avatar May 08 '24 08:05 pozylon

I think the way it is now it's consistent and changing all of the other types is a bit too much for the benefit.

pozylon avatar May 08 '24 08:05 pozylon

@pozylon we need it to implement this case https://github.com/xecutors/unchained-adminui/issues/488#issuecomment-2100044334 otherwise when adding a new text it will always default to context locale

Mikearaya avatar May 08 '24 09:05 Mikearaya

Screenshot from 2024-05-08 15-13-50

Mikearaya avatar May 08 '24 12:05 Mikearaya

@Mikearaya please add all of our discussed requirements to a ticket and open a new PR once you have it working

pozylon avatar May 08 '24 12:05 pozylon

or yes, use this one ^^

pozylon avatar May 08 '24 12:05 pozylon