Common "langs" type?

I am wondering if there is a lexicon type out there intended for folks to use in their own lexicons for i18n. Bluesky has their langs field. Others could emulate it, but there’s not much momentum or incentive to do so. If there were a well made internationalization type that I could use in my lexicons, it would be a lot easier for me to adopt that and for i18n behavior to be more consistent across lexicons.

For example, in this lex I have a langs field modeled after Bluesky’s approach.

{
  "lexicon": 1,
  "id": "community.lexicon.rating.prompt",
  "description": "A prompt or question that a rating answers, clarifying what aspect of a subject is being evaluated.",
  "defs": {
    "main": {
      "type": "record",
      "key": "tid",
      "record": {
        "type": "object",
        "required": ["text"],
        "properties": {
          "text": { "type": "string", "maxLength": 1024, "description": "The prompt or question text." },
          "langs": {
            "type": "array",
            "items": { "type": "string", "format": "language" },
            "maxItems": 3,
            "description": "BCP-47 tag(s) the prompt text is written in."
          },
          "createdAt": { "type": "string", "format": "datetime" }
        }
      }
    }
  }
}

But instead what if it just borrowed an existing type for language tagging.

{
  "lexicon": 1,
  "id": "community.lexicon.rating.prompt",
  "description": "A prompt or question that a rating answers, clarifying what aspect of a subject is being evaluated.",
  "defs": {
    "main": {
      "type": "record",
      "key": "tid",
      "record": {
        "type": "object",
        "required": ["text"],
        "properties": {
          "text": { "type": "string", "maxLength": 1024, "description": "The prompt or question text." },
          "langs": {
            "type": "ref", "ref": "some.i18n.thing",
          },
          "createdAt": { "type": "string", "format": "datetime" }
        }
      }
    }
  }
}

Thoughts? If I missed an existing topic on this my apologies.

5 Likes

Ahh, a way to offer translations of a given on-protocol string inside the record?

I know Scan/PaddingLabs was looking at building a translations app/lexicon, which would need a lexicon that represents translations, but they’d probably each have their own record.

I figure this would be a structure specifically for multi-lingual people, who want to be able to store different localisations of the same text on a supporting record. It seems fairly edge-case to me, though I’ve used the Bluesky pattern you mention in some lexicons.

I’ll take a look through my lexicon estate and see where something like this might be useful! :slight_smile:

2 Likes

Not even necessarily translations, but language tagging records so that they can be marked appropriately. Showing relevant content to people of different primary languages. Does also help for queuing browser and device translation.

1 Like

My guess is that having the convention of it being a top-level field named langs and having array-of-strings type is more important for reuse than having a declared lexicon schema to reference. For such a simple thing having a layer of indirection doesn’t feel worth it: easier for humans and machines to understand the lexicon-in-place than needing to go resolve the reference.

Generic app frameworks (like HappyView) could look for that data pattern, either in raw data or looking at the Lexicon schema.

(just my 2c)

1 Like

Just as a side note, there have been some issues filed for Bluesky because it uses (as far as I understood) ISO 639-1 with incomplete ISO 639-2 fallback.

I too prefer BCP 47 anyway though, since that’s vastly easier to use on the web and has better coverage. Its registry also looks very good to me in terms of being easy to process, for friendly naming in English UIs.
I think end users might be somewhat familiar with it too (or at least may recognise their own language and region tags) since they appear in URLs of localised sites quite often.

1 Like

hi!

I’ve a languages field in lichen wiki lexicon, I’m using BCP 47.

Felt like it was the best fit for lexicons as well.

1 Like