Modelling translation relationship for a multilingual app

I am working on Multilingual Social Network App...
We have translation for everything in our app ...
I was wondering whats the best way to achieve it.....
Initially I thought of doing like following


but then as we can have too many language codes in future... i prefered

(x)-[:HAS_TRANSLATION { locale: "en" }]->(LocaleOfX)

While doing this my client also wants to store the Languages that we offer in db... thus my question is which of the below three will give optimum performance and why...

(x)-[:HAS_TRANSLATION { locale: "en" }]->(LocaleOfX)


(x)-[:HAS_TRANSLATION]->(LocaleOfX { locale: "en" })

Choice3 (not sure of the query, but trying to establish a relation be

(x)-[:HAS_TRANSLATION]->(:Language { code: "en" })-[:HAS_LOCALE]->(LocaleOfX)

I am really confused here, so a help is needed from the experts :slight_smile:

Hey @mithun.das,

For my money, Choice 3 is my preferred approach.

Here are a few reasons:

  1. When you need to query for Locale or Language, you have a node as a starting point rather than a relationship. You will get a better database performance.
  2. Also, from a performance perspective, you can put indexes on node properties, but not on relationship properties.

FWIW, that's my 2 cents.


1 Like

Thank you sir... I am doing this exact modelling but was a bit confused if I am over complicating it or not.
But your response asured me.... especially the indexing point was something that was completely out of mind. Thank you. :slight_smile: