Skip to content

Passing a reactive value as msgid will potentially throw error #83

Description

@jimmleon

There are cases where passing a reactive or computed property as the msgid argument to the $pgettext function, will throw an error from the
normalizeMsgId function (src/utilities.ts):

Image

Example:

<script setup>
  const store = useStore()
  const getSomeComputedValue = computed(() => store.state.someStateProperty)
</script>

<template>
  <div>{{ $pgettext('some-context', getSomeComputedValue ) }}</div>
</template>

Should an early return be added to handle cases where the key arg is null/undefined, perhaps?
Or is this example a wrong usage of the pgettext function?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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