Translating Stock Chart

This tutorial will show how amCharts 5 built-in locale functionality can be used to apply custom translations to a Stock Chart.

Translating

We can use Root element's language object's setTranslationsAny() method to set prompt translations.

root.language.setTranslationsAny({
  "Settings": "Ajustes",
  "Draw": "Dibujar"
});
root.language.setTranslationsAny({
  "Settings": "Ajustes",
  "Draw": "Dibujar"
});

The below code provides a template for translation containing all of the prompts and names used in StockChart. Use it to create your full or partial translations:

root.language.setTranslationsAny({

  // Misc prompts
  "Line": "",
  "Candles": "",
  "Hollow Candles": "",
  "Sticks": "",
  "Fills": "",
  "Color": "",
  "Positive color": "",
  "Negative color": "",
  "Fill": "",
  "Save": "",
  "Cancel": "",
  "Apply": "",
  "Reset": "",
  "Comparison": "",
  "to": "",
  "Scroll to increment": "",
  "Click to toggle": "",
  "Search": "",
  "Search results are limited to %1.": "",

  // Settings
  "Settings": "",
  "Y-axis scale": "",
  "Change percent": "",
  "Regular": "",
  "Logarithmic": "",

  // Date-range selectors
  "Date Range": "",
  "Period selector": "",
  "D": "",
  "M": "",
  "YTD": "",
  "Y": "",
  "Max": "",
  "minute": "",
  "minutes": "",
  "hour": "",
  "hours": "",
  "day": "",
  "week": "",
  "month": "",
  "year": "",
  "Year": "",
  "Month": "",
  "Hour": "",
  "Minute": "",
  "Wk": "",

  // Drawing
  "Draw": "",
  "Drawing tool": "",
  "Snap icon to data": "",
  "Line color": "",
  "Line thickness": "",
  "Line style": "",
  "Fill color": "",
  "Text": "",
  "Text color": "",
  "Label font size": "",
  "Bold": "",
  "Italic": "",
  "Label font family": "",
  "Show line extension": "",
  "Eraser": "",
  "Clear": "",
  "Clear all drawings": "",
  "Callout": "",
  "Doodle": "",
  "Ellipse": "",
  "Fibonacci": "",
  "Fibonacci Timezone": "",
  "Horizontal Line": "",
  "Horizontal Ray": "",
  "Arrows & Icons": "",
  "Label": "",
  "Polyline": "",
  "Quadrant Line": "",
  "Rectangle": "",
  "Regression": "",
  "Trend Line": "",
  "Vertical Line": "",

  // Indicators
  "Indicators": "",
  "Increase": "",
  "Decrease": "",
  "Accumulation Distribution": "",
  "Accumulative Swing Index": "",
  "Use Volume": "",
  "Limit move value": "",
  "Period": "",
  "Aroon up": "",
  "Aroon down": "",
  "Increasing": "",
  "Decreasing": "",
  "Upper": "",
  "Average": "",
  "Lower": "",
  "Field": "",
  "Type": "",
  "Fast period": "",
  "Slow period": "",
  "Overbought": "",
  "Oversold": "",
  "Moving Average Type": "",
  "Fast MA period": "",
  "Slow MA period": "",
  "Signal period": "",
  "MACD": "",
  "Signal": "",
  "Offset": "",
  "Points/Percent": "",
  "Shift type": "",
  "Shift": "",
  "Top": "",
  "Median": "",
  "Bottom": "",
  "%K Smoothing": "",
  "%D Smoothing": "",
  "Fast": "",
  "Slow": "",
  "Signal color": "",
  "Up volume": "",
  "Down volume": "",
  "Deviation": "",
  "Depth": "",
  "Aroon": "",
  "Awesome Oscillator": "",
  "Bollinger Bands": "",
  "Chaikin Money Flow": "",
  "Chaikin Oscillator": "",
  "Commodity Channel Index": "",
  "Disparity Index": "",
  "Moving Average": "",
  "Moving Average Deviation": "",
  "Moving Average Envelope": "",
  "On Balance Volume": "",
  "Relative Strength Index": "",
  "Standard Deviation": "",
  "Stochastic Oscillator": "",
  "Trix": "",
  "Typical Price": "",
  "Volume": "",
  "VWAP": "",
  "Williams R": "",
  "Median Price": "",
  "ZigZag": ""
});
root.language.setTranslationsAny({

  // Misc prompts
  "Line": "",
  "Candles": "",
  "Hollow Candles": "",
  "Sticks": "",
  "Fills": "",
  "Color": "",
  "Positive color": "",
  "Negative color": "",
  "Fill": "",
  "Save": "",
  "Cancel": "",
  "Apply": "",
  "Reset": "",
  "Comparison": "",
  "to": "",
  "Scroll to increment": "",
  "Click to toggle": "",
  "Search": "",
  "Search results are limited to %1.": "",

  // Settings
  "Settings": "",
  "Y-axis scale": "",
  "Change percent": "",
  "Regular": "",
  "Logarithmic": "",

  // Date-range selectors
  "Date Range": "",
  "Period selector": "",
  "D": "",
  "M": "",
  "YTD": "",
  "Y": "",
  "Max": "",
  "minute": "",
  "minutes": "",
  "hour": "",
  "hours": "",
  "day": "",
  "week": "",
  "month": "",
  "year": "",
  "Year": "",
  "Month": "",
  "Hour": "",
  "Minute": "",
  "Wk": "",

  // Drawing
  "Draw": "",
  "Drawing tool": "",
  "Snap icon to data": "",
  "Line color": "",
  "Line thickness": "",
  "Line style": "",
  "Fill color": "",
  "Text": "",
  "Text color": "",
  "Label font size": "",
  "Bold": "",
  "Italic": "",
  "Label font family": "",
  "Show line extension": "",
  "Eraser": "",
  "Clear": "",
  "Clear all drawings": "",
  "Callout": "",
  "Doodle": "",
  "Ellipse": "",
  "Fibonacci": "",
  "Fibonacci Timezone": "",
  "Horizontal Line": "",
  "Horizontal Ray": "",
  "Arrows & Icons": "",
  "Label": "",
  "Polyline": "",
  "Quadrant Line": "",
  "Rectangle": "",
  "Regression": "",
  "Trend Line": "",
  "Vertical Line": "",

  // Indicators
  "Indicators": "",
  "Increase": "",
  "Decrease": "",
  "Accumulation Distribution": "",
  "Accumulative Swing Index": "",
  "Use Volume": "",
  "Limit move value": "",
  "Period": "",
  "Aroon up": "",
  "Aroon down": "",
  "Increasing": "",
  "Decreasing": "",
  "Upper": "",
  "Average": "",
  "Lower": "",
  "Field": "",
  "Type": "",
  "Fast period": "",
  "Slow period": "",
  "Overbought": "",
  "Oversold": "",
  "Moving Average Type": "",
  "Fast MA period": "",
  "Slow MA period": "",
  "Signal period": "",
  "MACD": "",
  "Signal": "",
  "Offset": "",
  "Points/Percent": "",
  "Shift type": "",
  "Shift": "",
  "Top": "",
  "Median": "",
  "Bottom": "",
  "%K Smoothing": "",
  "%D Smoothing": "",
  "Fast": "",
  "Slow": "",
  "Signal color": "",
  "Up volume": "",
  "Down volume": "",
  "Deviation": "",
  "Depth": "",
  "Aroon": "",
  "Awesome Oscillator": "",
  "Bollinger Bands": "",
  "Chaikin Money Flow": "",
  "Chaikin Oscillator": "",
  "Commodity Channel Index": "",
  "Disparity Index": "",
  "Moving Average": "",
  "Moving Average Deviation": "",
  "Moving Average Envelope": "",
  "On Balance Volume": "",
  "Relative Strength Index": "",
  "Standard Deviation": "",
  "Stochastic Oscillator": "",
  "Trix": "",
  "Typical Price": "",
  "Volume": "",
  "VWAP": "",
  "Williams R": "",
  "Median Price": "",
  "ZigZag": ""
});

Demo

Below demo uses custom translations to translate Stock Chart into Lithuanian:

See the Pen Stock chart with custom translation by amCharts team (@amcharts) on CodePen.