Habitica: redundant / duplicated / confusing use of "health" locales strings

Created on 31 Aug 2016  路  3Comments  路  Source: HabitRPG/habitica

In the Commonwealth of i18n - Aspiring Linguists of Habitica guild, Aleksandra (9f98e468-9290-474b-aab8-55440f41510e) wrote:

Hello! I have a small issue. Is it possible to change the string for "Health" in somebody's profile (when you click on their name in the chat) to the one from the character.json on Transifex instead of the front.json? Because in the front.json that word is a part of a sentence so it gets a different form, which then becomes incorrect in a different context. This was pointed out to me today in the Polish players' guild, but I'm sure it might influence some other languages too."

The two strings referred to are, I think, these:

front.json line 71:    "health": "Health",
character.json line 78:    "health": "Health",

These are the places where they are used:

website/client/js/services/notificationServices.js line 74:    _notify(_sign(val) + " " + _round(val) + " " + window.env.t('health'), 'hp', 'glyphicon glyphicon-heart');
website/views/shared/header/header.jade line 10:      .meter-label(tooltip=env.t('health'))
website/views/shared/modals/death.jade line 11:            .meter-label(tooltip=env.t('health'))
website/views/shared/modals/low-health.jade line 8:      .meter-label(tooltip=env.t('health'))
website/views/shared/modals/settings.jade line 21:          label.control-label=env.t('health')
website/views/static/front.jade line 177:                a(href='#')=env.t('health')
website/views/static/front.jade line 237:                h3= env.t('health')

I had thought that whenever there are strings with the same key, one would be automatically overridden by the other, but I might be wrong.

We might need to investigate how those string are meant to be used and remove the redundancy or give each one a unique key. A two-word key is better than a one-word key because it makes grepping give more precise results.

Anyone who has additional information about this is welcome to comment here!

medium status needs investigation translations

All 3 comments

Part of this work should be to write a sanity check that keys are not duplicated.

I've added the sanity check (skipped for now) https://github.com/HabitRPG/habitrpg/commit/ebef5ad60c363af3d6ab571461f424a8791f7229

Here are the duplicate keys it found:

health in ./common/locales/en/front.json already exists in ./common/locales/en/character.json.
classBonus in ./common/locales/en/gear.json already exists in ./common/locales/en/character.json.
all in ./common/locales/en/generic.json already exists in ./common/locales/en/challenge.json.
npcText in ./common/locales/en/npc.json already exists in ./common/locales/en/contrib.json.
email in ./common/locales/en/settings.json already exists in ./common/locales/en/front.json.
add in ./common/locales/en/settings.json already exists in ./common/locales/en/generic.json.

When this is PRd, the test should be made active. (remove .skip)

Was this page helpful?
0 / 5 - 0 ratings