String IDs in the site do not match IDs in JSON files

in #utopian-io9 years ago

I'm going to present an issue regarding the strings in staging.busy.org. There are cases when the id of the used string does not match the string in the locale JSON files. It results in text that is translated but the translation is not visible on the site.

VoteActionMessage.js

VoteActionMessage.jsen.jsontext
user_upvoted_postuser_upvoted"{username} upvoted"
user_downvoted_postuser_downvoted"{username} downvoted"
user_unvoted_postuser_unvoted"{username} unvoted"
voting_weightvote_weight"Vote weight"

image.png

image.png

image.png

image.png

You can see here that the strings were translated to Czech. The mismatching IDs causes trouble and the strings would actually not be seen as translated.

Another issue is that the messages with IDs in {upvoted, downvoted, unvoted} are capitalized although the text should have only the first letter in capital.

Error401.js

This file contains a message for the page warning the user that hey have to login to proceed. You can see it if you go to <staging.busy.org/wallet> while not logged in.

Error401.jsen.json
@statics/need_loginmissing
@statics/here_linkmissing
@statics/homepagemissing

You can see that I tried to fix this minor issue in a PR but Sekhmet also suggested another change that would require more knowledge. First new ids were suggested so that they are easier to recognize.

old IDnew ID
need_loginlogin_required
homepagehomepage_link
here_link??

image.png

<p>
  <FormattedMessage
    id="@statics/need_login"
    defaultMessage="You need to login to use this feature, please"
  />{' '}
  <a href={SteemConnect.getLoginURL()}>
  <FormattedMessage id="login" defaultMessage="Login" />
  </a>
  <br />
  <FormattedMessage id="@statics/here_link" defaultMessage="Here's a link to the" />
  <Link to="/">
  <FormattedMessage id="@statics/homepage" defaultMessage="home page" />
  </Link>
   .
</p>

I had one solution in mind regarding no prior knowledge of JS or React. I changed the ids and merged some strings together in order to work with them easily. This, however, doesn't work well.

<FormattedMessage
  id="login_required"
  defaultMessage="You need to {login} to use this feature."
  values={{
    login: <Link to={SteemConnect.getLoginURL()}>login</Link>,
  }}
/>
<br />
<FormattedMessage
  id="homepage_link"
  defaultMessage="Here's a link to the {home_page}."
  values={{
    home_page: <Link to="/">home page</Link>,
  }}
/>

To have the link embedded in the string, it should probably look like this. This is probably incorrect way of doing it but it is only a suggestion and my way of understanding the issue. Those sentences must be easy to manipulate so that they can be translated without difficulties.

<FormattedMessage
  id="login_required"
  defaultMessage="You need to <a href="{SteemConnect.getLoginURL()}">login</a> to use this feature."
/>
<br />
<FormattedMessage
  id="homepage_link"
  defaultMessage="Here's a link to the <a href="/">home page</a>."
/>



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

1up-logo.png


You've got a 1UP from the @utopian-1up curation trail. 24 Utopians have upvoted your quality contribution to the open source community.

Join 1UP for better posts and high curation rewards.

1UP is neither organized nor endorsed by Utopian.io!

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @espoem I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.04
TRX 0.33
JST 0.102
BTC 65282.73
ETH 1887.94
USDT 1.00
SBD 0.39