Skip to content

What is the best way to model multiple language content in edgedb? #4951

Answered by raddevon
dodyg asked this question in Q&A
Discussion options

You must be logged in to vote

This approach looks fine to me. You might also take some inspiration from this user on our Discord: https://discord.com/channels/841451783728529451/849374705210490900/1057455954578395176

module default {
  scalar type Locale extending enum<en, gr>;

  required global current_locale -> Locale {
    default := Locale.en;
  };
  
  type Item {
    multi link name -> Translation {
      constraint exclusive;
    }
    link current_name := (
      select .name filter .locale = global current_locale
    );
  }

  type Translation {
    required property locale -> Locale;
    required property text -> str;
  }
}

There's also some interesting discussion in this message's thread along with a simi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dodyg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants