I'm in a dilema where I'm translation a full mobile app where the translations are going to be a key value pair but I'm not sure how to name the key.

Should I name the keys describing what the text is, like (key: ok, text: Ok), or should I name the key from where it is on the screen/context, like (key: screenXButton, text: Ok) ?

  • Are the translations always going to be the same for a given source phrase across all screens?
    – Caleth
    Commented May 11, 2021 at 12:06
  • @Caleth yes, I will have one file with everything
    – Vencovsky
    Commented May 11, 2021 at 12:19
  • 1
    @Vencovsky: that was not Caleth's question. He was asking if a text like "Ok" maybe translated to "D'accordo!" on one screen, and "Passbile" on another (I took italian as an example).
    – Doc Brown
    Commented May 14, 2021 at 13:02

2 Answers 2


I recommend this

  • provide a general translation, where the key is based on the original text, and which you can reuse at several places (like key: ok, text: Ok)

  • for cases where the general translation won't fit, add a second translation where the key is the same plus a suffix indicating the context.

    For example, lets say you have a screen where "Ok" refers to this special kind of boat, you may use key: ok_dinghy, text: "OK-Jolle (in german). If there is one and only one place in your application where this translation is used, and you don't have any better idea of coming up with a context name, you may refer to it like Key:ok_screenXButton, but I would avoid this, if possible. Otherwise you end up in maintaining the name of such buttons not only in the screen code, but also in the translation table.


Naming the key for it's intended functionality is the better option. After all, when you change the position on the screen, do you really rename it? It will still be a key representing OK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.