Skip to content

Locale File Not Found (kr.json) When Using Older Version Due to CDN Fetching Latest #1003

@kjeongh

Description

@kjeongh

I've encountered an issue when using emoji-mart v5.5.1, and I’d like to clarify certain points regarding locale file handling and share my experience for future reference.

problem

  1. At some point, the emoji-picker menu was empty.
  2. I found that the request to kr.json from the CDN failed with 404 error, and that was the cause.
  3. I realized that kr.json in the emoji-mart/data package is now ko.json.
  4. The relevant fetch code is written in a way that forces the use of the latest version on the CDN (@latest), regardless of the library version in use.
  I18n =
    (typeof props.i18n === 'function' ? await props.i18n() : props.i18n) ||
    (locale == 'en'
      ? i18n_en
      : await fetchJSON(
          `https://cdn.jsdelivr.net/npm/@emoji-mart/data@latest/i18n/${locale}.json`, // latest version: kr.json not exists
        ))
  1. Since I'm using v5.5.1(the locale option is still 'kr'), the application tries fetching kr.json, which no longer exists. Changing the locale value to ko is not a viable workaround. because v5.5.1 does not recognize it and simply falls back to the default value, 'en'.
  2. So, I copied kr.json from the repository and pass it directly using i18n prop.

My Questions

  • Why does the picker component always fetch locale files from the latest version on the CDN, instead of matching the version of the library in use? Doesn't this inevitably cause version mismatch issues, especially when locale file names or contents change?
  • Are there alternative solutions to handle this type of issue besides quickly upgrading, or serving custom static assets? Did I miss any recommended way to handle missing/renamed locales when pinned to an older library version?

Thank you for your hard work and for any input on this topic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions