Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on creating a new locale, for Latin language. #522

Open
arishojaei opened this issue Apr 8, 2024 · 0 comments
Open

Error on creating a new locale, for Latin language. #522

arishojaei opened this issue Apr 8, 2024 · 0 comments

Comments

@arishojaei
Copy link

arishojaei commented Apr 8, 2024

Based on the description of some issues here and StackOverflow about updateLocale, I tried to create a new locale but still my locale can't resolve in build.

Package Version
nuxt ^2.17.0
@nuxtjs/dayjs ^1.4.1

nuxt.config.js

plugins: [
  '~/plugins/dayjs.js',
],

modules: [
 '@nuxtjs/dayjs'
],

dayjs: {
  locales: ['en', 'de', 'la'], // la for Latin language
  defaultLocale: 'de',
  plugins: [
    'utc',
    'timezone',
    'customParseFormat',
    'advancedFormat',
  ],
},

~/plugins/dayjs.js

export default function ({ $dayjs }) {
  $dayjs.locale('la', {
    name: 'la',
    weekdays: ["Dies Lunae", "Dies Martis", "Dies Mercurii", "Dies Iovis", "Dies Veneris", "Dies Saturni", "Dies Solis"],
    weekdaysShort: ["Lun.", "Mar.", "Mer.", "Iov.", "Ven.", "Sat.", "Sol."],
    weekdaysMin: ["Lu.", "Ma.", "Me.", "Jo.", "Ve.", "Sa.", "So."],
    weekStart: 1,
    yearStart: 4,
    months: ["Ianuarius", "Februarius", "Martius", "Aprilis", "Maius", "Iunius", "Iulius", "Augustus", "September", "October", "November", "December"],
    monthsShort: ["Ian.", "Feb.", "Mar.", "Apr.", "Mai", "Iun.", "Iul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."],
    ordinal: n => `${n}º`,
    formats: {
      LTS: 'h:mm:ss A',
      LT: 'h:mm A',
      L: 'MM/DD/YYYY',
      LL: 'MMMM D, YYYY',
      LLL: 'MMMM D, YYYY h:mm A',
      LLLL: 'dddd, MMMM D, YYYY h:mm A',
      l: 'D/M/YYYY',
      ll: 'D MMM, YYYY',
      lll: 'D MMM, YYYY h:mm A',
      llll: 'ddd, MMM D, YYYY h:mm A'
    },
    relativeTime: {
      future: 'in %s',
      past: 'ante %s',
      s: 'paucis momentis',
      m: 'minuto',
      mm: '%d minutis',
      h: 'hora',
      hh: '%d horis',
      d: 'die',
      dd: '%d diebus',
      M: 'mense',
      MM: '%d menses',
      y: 'anno',
      yy: '%d annis'
    },
    meridiem: (hour, minute, isLowercase) => {
      return hour > 12 ? 'PM' : 'AM'
    }
  })
}

Problem

I get Nuxt Fatal Error for not founding the la locale on build:

ERROR in ./.nuxt/dayjs-plugin.js
Module not found: Error: Can't resolve 'dayjs/locale/la' in '/Users/ari/Documents/Projects/noeku-boilerplate/.nuxt'
 @ ./.nuxt/dayjs-plugin.js 5:0-25
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ ./.nuxt/nuxt-speedkit/entry.js
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/nuxt-speedkit/entry.js

 FATAL  Nuxt build error                                                                                   3:29:53 PM

  at WebpackBundler.webpackCompile (node_modules/@nuxt/webpack/dist/webpack.js:1868:21)
  at processTicksAndRejections (internal/process/task_queues.js:95:5)
  at async WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:1833:5)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:249:5)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-build.js:99:7)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:356:7)


   ╭─────────────────────────────╮
   │                             │
   │   ✖ Nuxt Fatal Error        │
   │                             │
   │   Error: Nuxt build error   │
   │                             │
   ╰─────────────────────────────╯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant