Skip to content

A scheme for handling translations for hard coded elements.

Notifications You must be signed in to change notification settings

ruffcorn33/handle-translations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

handle-translations

A scheme for handling translation of hard-coded elements.

Usage

import getTranslation from "../translations/translations";

let translate = getTranslation("default");

In ComponentWillMount()

// get translations
if (this.props.language) {
    translate = getTranslation(this.props.language);
}
else {
    translate = getTranslation("default");
}

In use

<Button className="cancel-button" onClick={this.props.cancelMethod}>{translate.Cancel}</Button>

Best practices

Keep translation objects sorted alphabetically.

About

A scheme for handling translations for hard coded elements.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published