How to use vue-i18n-locale-message - 2 common examples

To help you get started, weโ€™ve selected a few vue-i18n-locale-message examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antfu / i18n-ally / src / core / loaders / VueSfcLoader.ts View on Github external
for (const pending of pendings) {
      const record = this.getRecordByKey(pending.keypath, pending.locale, true)
      if (!record)
        continue

      const sectionIndex = record.meta ? (record.meta.VueSfcSectionIndex || 0) : 0

      const section = this._meta.components[this.filepath][sectionIndex]

      const locale = record?.meta?.VueSfcLocale || pending.locale

      section.messages[locale] = await applyPendingToObject(section.messages[locale] || {}, pending)
    }

    const doc = await workspace.openTextDocument(this.uri)
    const [file] = infuse(Global.rootpath, this.getSFCFileInfo(doc), this._meta)

    if (doc.isDirty) {
      const edit = new WorkspaceEdit()
      edit.replace(this.uri, new Range(doc.positionAt(0), doc.positionAt(Infinity)), file.content)

      await workspace.applyEdit(edit)
    }
    else {
      await File.write(this.filepath, file.content)
    }

    await this.load()
  }
github antfu / i18n-ally / src / core / loaders / VueSfcLoader.ts View on Github external
async load () {
    const filepath = this.filepath
    Log.info(`๐Ÿ“‘ Loading sfc ${filepath}`)
    const doc = await workspace.openTextDocument(this.uri)
    const meta = this._meta = squeeze(Global.rootpath, this.getSFCFileInfo(doc))
    this._parsedSections = meta.components[filepath]

    this.updateLocalesTree()
    this._onDidChange.fire(this.name)
  }

vue-i18n-locale-message

i18n locale messages management tool / library for vue-i18n

MIT
Latest version published 2 years ago

Package Health Score

47 / 100
Full package analysis

Popular vue-i18n-locale-message functions