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

Labels API - localisation support #45

Open
ThisIsMissEm opened this issue Feb 25, 2025 · 2 comments
Open

Labels API - localisation support #45

ThisIsMissEm opened this issue Feb 25, 2025 · 2 comments

Comments

@ThisIsMissEm
Copy link
Contributor

This will add support for providing labels in multiple languages.

@ThisIsMissEm
Copy link
Contributor Author

Some code researched already for this purposes, not sure if I'll use it:

import { parseLanguageTag } from '@phensley/language-tag'

vine.object({
  nameMap: vine.record(vine.string().trim()).validateKeys((keys, field) => {
    const nonBcp47Key = keys.find((key) => parseLanguageTag(key).compact() === 'und')
  
    if (!nonBcp47Key) {
      field.report(
        'Language must be a valid BCP-47 language tag', // message
        'record.keys.language',
        field
      )
    }
  }),
})

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