Translation system should allow hyperlinks on sub-messages #6848
Labels
area-translation
Issues relating to translating the app into various languages.
Milestone
Our translation system allows users to experience MetaMask in their own language (provided translations exist). Developers simply need to pass a string to the
t
method available on context and that method will get the string in the user's preferred language. For example:t('send')
. Translators just reference themetamask-extension/app/_locales/en/messages.json
file and add translations of the messages to their respective languages file.Suppose a developer enters
t('providerRequestInfo)
, given our english translation, this would render as "This site is requesting access to view your current account address. Always make sure you trust the sites you interact with." Of course, the developer would have to pass that string to the appropriate expression within jsx, e.g.<div className="provider-info"><span>{ t('providerRequestInfo) }</span></div>
Now, what if there is a requirement to have the "current account" substring of the above message be hyperlinked to an external page with info about the current account? If translation was not a concern, something like the following would work:
But translation is a concern, we still want to be able to do something like
<div className="provider-info"><span>{ t('providerRequestInfo') }</span></div>
, but maybe with some extra info passed tot()
.Note that we can't just do
Because not all translations will be structured the same way and may have very different semantics. For example, the Korean translation of
'providerRequestInfo'
is "아래 나열된 도메인은 Web3 API에 대한 액세스를 요청하여 Ethereum 블록 체인과 상호 작용할 수 있습니다. Ethereum 액세스를 승인하기 전에 항상 올바른 사이트에 있는지 다시 확인하십시오".The task is to upgrade our translation system to:
Basic task requirement:
Advanced requirement:
t()
methodThe text was updated successfully, but these errors were encountered: