Skip to content

Get current locale #20

@MickL

Description

@MickL

Clear and concise description of the problem

I am missing documentation on how to get the locale of the current event. What I would expect:

export default defineEventHandler(async (event) => {
   console.log(event.context.locale);
});

From what I am guess, one needs to call a function at the moment. This however, will each time call the localeDetector:

event.context.i18n.locale()

Additionally this shows up a TypeScript error Type String has no call signatures. even tho it is a function and not a string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    H3featureIncludes new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions