Private Information

A brief overview of working with Private Information in GT.

Overview

Private information is generally any information that should remain private. For example, a user's Social Security Number (SSN), Tax Identification Number (TIN), or email address.

In order to keep this information private while translating, we use the <Var> component. The <Var> component is used to wrap any content that should not be shared, and the content inside the <Var> component will always remain the same. This is great for names, emails, addresses, etc.

Sometimes, we do want to display private information, but we still need to reformat it based on the user's preferred languages, regional regulations, etc. For example, we might want to display a user's bank account balance in their local currency. In these cases, we instead use either <Currency>, <DateTime>, or <Num> components.

Example

The <Var> component is also useful for displaying private information.

PrivateInfo.jsx
import { T, Var } from 'gt-next'
 
export default function PrivateInfo(email) {
    return (
        <T id='private-info'>
            Your email address is <Var>{email}</Var>.
        </T>
    );
}

The children of the <Var> component will not be translated. Its contents will never be passed to the General Tranlsation API. Its contents will not be distrubuted to the CDN.

On this page