Git Product home page Git Product logo

Comments (6)

lvshaoping007 avatar lvshaoping007 commented on June 6, 2024

Why use the Trans component and are there any risks? I prefer I18n to return strings instead of components

from oasis-wallet-ext.

lukaw3d avatar lukaw3d commented on June 6, 2024

I think Trans component is safe, but strings are even better

In that case, these need to be updated:

"dontclose": "And <b>do not close</b> this window.",
"dontclose": "在此之前<b>请勿关闭</b>此窗口。",

from oasis-wallet-ext.

lvshaoping007 avatar lvshaoping007 commented on June 6, 2024

should dontclose be change ? is this have question ? because there have style with text in a line ?

from oasis-wallet-ext.

lukaw3d avatar lukaw3d commented on June 6, 2024

yes

from oasis-wallet-ext.

lvshaoping007 avatar lvshaoping007 commented on June 6, 2024

ok, If I split with a special string and then set the style, is it safe? like "And [[ do not close ]] this window." ,I will split by [[ and ]] , then set bold style

from oasis-wallet-ext.

lukaw3d avatar lukaw3d commented on June 6, 2024

You might be able to do that safely, but it seems too complex. E.g. simple "dontclose": "And [[do not close]] this window.", + <p className="wallet-tip-description" key={tip} dangerouslySetInnerHTML={{ __html: getLanguage(tip).replace('[[', '<b>').replace(']]', '</b>') }} /> is not safe.

Splitting translations "dontclose1": "And", "dontclose2": "do not close", "dontclose3": "this window." seems too annoying.

I would say either:

  • use string and remove style "dontclose": "And do not close this window.", + <p className="wallet-tip-description" key={tip}>{ getLanguage(tip) }</p>
  • use Trans "dontclose": "And <strong>do not close</strong> this window.", + <p className="wallet-tip-description" key={tip}><Trans i18nKey={tip}></Trans></p>

from oasis-wallet-ext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.