LiamMartens/sanity-plugin-intl-input

Unable to use Intl object input with Sanity Studio >= ^2.9.0 even with beta.1

flayks opened this issue · 5 comments

I tried to make the Intl input plugin work with Sanity >=2.9.0 but I get this error instead:

Error in ./node_modules/sanity-plugin-intl-input/lib/resolver (part:@sanity/form-builder/input-resolver)
Module not found: Error: Can't resolve '@sanity/form-builder/lib/utils/isEmpty' in '/Users/flayks/sites/site/sanity/node_modules/sanity-plugin-intl-input/lib/resolver'
 @ ./node_modules/sanity-plugin-intl-input/lib/resolver (part:@sanity/form-builder/input-resolver 14:14-63)

Example of a field:

// ./schemas/wine/wine.js
...
{
    name: 'conditions',
    title: 'Vintage conditions',
    type: 'text',
    options: {
        i18n: true,
        base: baseLanguage,
        languages,
    },
},

// ./schemas/languages.js
export const languages = [
    { name: 'en', title: 'English', default: true },
    { name: 'fr', title: 'Français' },
]

export const baseLanguage = languages.find(lang => lang.default)

As with the latest stable version (5.0.6), when using with the default example from Sanity with the version 2.9.0 or 2.10.0, I simply can't see the Intl object input for instance. No error here, but nothing is displayed in the document 🤷 I have to downgrade to Sanity 2.6.0 to see it.

@flayks fixed with 5.1.0

Hi, seems like version 5.2.0 is not available on NPM, could you please publish it?
Cause I have the same problem that the int object is not visible on the page, I'm using sanity-plugin-intl-input: 5.1.0 with sanity 2.10.5

@victory-sokolov hm I think I actually ment it should be fixed with v5.1.0 -- you have the exact same error?

I don't have any errors, but when I'm using Intl object for a specific input, languages for translation are not displayed.
Wide translation works fine

Also finding this with sanity-plugin-intl-input@5.2.1 and sanity@2.19.0. The following works:

{
  name: 'label',
  title: 'Label',
  type: 'object',
  options: {
    i18n: true
  },
  fields: [
    {
      name: 'example',
      title: 'Example',
      type: 'string'
    }
  ]
}

This doesn't:

{
  name: 'label',
  title: 'Label',
  type: 'string',
  options: {
    i18n: true
  }
}

No error, it just doesn't do anything. The documentation doesn't say whether it's possible to apply to fields like string, is this supported?