I know how to translate the text and so on. But I don't know how to translate text from a script (textMeshPro + value), like this script of mine. I'm using unity's own localization, which is easy for me to use.
Translate the words: Coins and DEATH COUNT + value (data.coin)
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public class SaveSlot : MonoBehaviour
{
[Header("Profile")]
[SerializeField] private string profileId = "";
[Header("Content")]
[SerializeField] private GameObject noDataContent;
[SerializeField] private GameObject hasDataContent;
[SerializeField] private TextMeshProUGUI CoinText;
[SerializeField] private TextMeshProUGUI deathCountText;
[Header("Clear Data Button")]
[SerializeField] private Button clearButton;
public bool hasData { get; private set; } = false;
private Button saveSlotButton;
private void Awake()
{
saveSlotButton = this.GetComponent<Button>();
}
public void SetData(GameData data)
{
// there's no data for this profileId
if (data == null)
{
hasData = false;
noDataContent.SetActive(true);
hasDataContent.SetActive(false);
clearButton.gameObject.SetActive(false);
}
// there is data for this profileId
else
{
hasData = true;
noDataContent.SetActive(false);
hasDataContent.SetActive(true);
clearButton.gameObject.SetActive(true);
CoinText.text = "Coins: " + data.coin;
deathCountText.text = "DEATH COUNT: " + data.deathCount;
}
}
public string GetProfileId()
{
return this.profileId;
}
public void SetInteractable(bool interactable)
{
saveSlotButton.interactable = interactable;
clearButton.interactable = interactable;
}
}
`
Translate string I already know more or less, but not the TextMeshPro + the value. How do I have to translate?