Really vague localization question
Really vague localization question
Hi Tony
We're starting to think about expanding our game to feature custom localization for each build. I imagine it would be a set of variables something like ["Firewood"] which would be replaced with local language. To adapt this for multiple projects with many languages we would create separate variable databases and then merge those into the main system when building.
I imagine that the above will work as expected, my question is: is it possible to feed the text of another system, such as uSurvival, into Dialogue System's UI so that, if a sting such as ["Firewood"] were present, it could be converted?
Thanks in advance,
Last update was
Nathan
We're starting to think about expanding our game to feature custom localization for each build. I imagine it would be a set of variables something like ["Firewood"] which would be replaced with local language. To adapt this for multiple projects with many languages we would create separate variable databases and then merge those into the main system when building.
I imagine that the above will work as expected, my question is: is it possible to feed the text of another system, such as uSurvival, into Dialogue System's UI so that, if a sting such as ["Firewood"] were present, it could be converted?
Thanks in advance,
Last update was
Nathan
Re: Really vague localization question
You can localize everything in the Dialogue System. I'm guessing that Variable["Firewood"] is a number representing the amount of firewood the player has collected. Let's say you have a quest named "Get Firewood" with these fields:
There are two types of non-Dialogue System text to localize. You can use Text Tables for both:
1. UI elements (e.g., the Login button). See Using Text Tables to Localize UIs.
2. Other text. Assuming the text has a localize entry in your text table, just call DialogueManager.GetLocalizedText("your text") to get the localized version from the text table, or use the corresponding visual scripting action.
- Name: "Get Firewood"
- Description: "Search the area for enough wood to build a fire."
- Entry 1: "[var=Firewood]/3 Collected"
- Name: "Get Firewood"
- Display Name: "Get Firewood"
- Display Name fr: "Obtenez du bois de chauffage"
- Description: "Search the area for enough wood to build a fire."
- Description fr: "Cherchez suffisamment de bois dans la région pour faire un feu."
- Entry 1: "[var=Firewood]/3 Collected"
- Entry 1 fr: "[var=Firewood]/3 Obtenu"
There are two types of non-Dialogue System text to localize. You can use Text Tables for both:
1. UI elements (e.g., the Login button). See Using Text Tables to Localize UIs.
2. Other text. Assuming the text has a localize entry in your text table, just call DialogueManager.GetLocalizedText("your text") to get the localized version from the text table, or use the corresponding visual scripting action.
Re: Really vague localization question
Thanks Tony,
I'm only looking to replace nouns and verbs, not all text, so Loclization is more than what we need.
I'm hoping for something like the Localize UI but that dynamically updates, so it would behave similar to the Alert panel. In fact, if there were a way to have all UI text display the same way the Alert Panel does all my needs would be served. Is this possible? I'm guessing it might be an inefficient way of doing things.
I'm still thinking that using a variable system to replace text will still be the most efficient way to do this (I do love to be proved wrong if I'm on the wrong path though). So rather than assigning a numerical value to "Firewood" its 'Initial Value' would be its translated text "djarraba". Using a Text Table would be a lot cleaner but a collection of variables isn't terrible.
Because we aim to do this for numerous communities, each with its own unique language, I'm thinking that each project would have its own variable database that would be merged with the main database to allow for the localisation.
The biggest challenge with the method I described above (as this already works entirely in DS) is having Unity UI displaying the LUA variable's 'Initial Value'; is this possible? Is there a way to send, say, the UI content of uSurvival through a Dialogue Manager so that if the item was labelled "[var=Firewood]" it could replace the string "[var=Firewood]" with "djarraba" when displayed in the UI?
Does this sound like a workable method to you?
I hope this isn't too far out of the scope of DS.
Thanks once again,
Nathan
I'm only looking to replace nouns and verbs, not all text, so Loclization is more than what we need.
I'm hoping for something like the Localize UI but that dynamically updates, so it would behave similar to the Alert panel. In fact, if there were a way to have all UI text display the same way the Alert Panel does all my needs would be served. Is this possible? I'm guessing it might be an inefficient way of doing things.
I'm still thinking that using a variable system to replace text will still be the most efficient way to do this (I do love to be proved wrong if I'm on the wrong path though). So rather than assigning a numerical value to "Firewood" its 'Initial Value' would be its translated text "djarraba". Using a Text Table would be a lot cleaner but a collection of variables isn't terrible.
Because we aim to do this for numerous communities, each with its own unique language, I'm thinking that each project would have its own variable database that would be merged with the main database to allow for the localisation.
The biggest challenge with the method I described above (as this already works entirely in DS) is having Unity UI displaying the LUA variable's 'Initial Value'; is this possible? Is there a way to send, say, the UI content of uSurvival through a Dialogue Manager so that if the item was labelled "[var=Firewood]" it could replace the string "[var=Firewood]" with "djarraba" when displayed in the UI?
Does this sound like a workable method to you?
I hope this isn't too far out of the scope of DS.
Thanks once again,
Nathan
Re: Really vague localization question
Hi Nathan,
What kind of UI text are you thinking of? The LocalizeUI component is for design-time text, such as the word "QUIT" on uSurvival's Quit button. This pulls translations from a text table.
If you're talking about, say, the interaction text that appears when you mouse over an item or a door, uSurvival produces that at runtime. Fortunately, it's pretty easy to add localization. I'll explain how to localize the door interaction text, but the same process applies to items.
Make a copy of Door.cs. Rename is something like Door2.cs or DoorLocalized.cs. Edit it and rename the class accordingly. Change the GetInteractionText() method from this:
to something like this:
Then add two entries to your text table:
You'll need to use this script in place of Door in your project. You could always directly edit Door.cs, but then you'll need to remember to re-add those edits if you ever update uSurvival.
What kind of UI text are you thinking of? The LocalizeUI component is for design-time text, such as the word "QUIT" on uSurvival's Quit button. This pulls translations from a text table.
If you're talking about, say, the interaction text that appears when you mouse over an item or a door, uSurvival produces that at runtime. Fortunately, it's pretty easy to add localization. I'll explain how to localize the door interaction text, but the same process applies to items.
Make a copy of Door.cs. Rename is something like Door2.cs or DoorLocalized.cs. Edit it and rename the class accordingly. Change the GetInteractionText() method from this:
Code: Select all
public string GetInteractionText()
{
return (open ? "Close" : "Open") + " door";
}
Code: Select all
public string GetInteractionText()
{
return PixelCrushers.DialogueSystem.GetLocalizedText((open ? "Close" : "Open") + " door");
}
- "Open door"
- "Close door"
Code: Select all
public string GetInteractionText()
{
return PixelCrushers.DialogueSystem.FormattedText.ParseCode((open ? "Close" : "Open") + " [var=door]");
}
Re: Really vague localization question
Thanks, Tony!
This is great. I’m out of the office for the weekend but will try this in a few days.
One more question. Can the Dialogue and Quest UI display Text Table content the same way that the Alert panel does? It tried setting this up yesterday but didn’t have any success.
Thank you,
Nathan
This is great. I’m out of the office for the weekend but will try this in a few days.
One more question. Can the Dialogue and Quest UI display Text Table content the same way that the Alert panel does? It tried setting this up yesterday but didn’t have any success.
Thank you,
Nathan
Re: Really vague localization question
Hi Nathan,
UI elements like the dialogue UI's Continue button and the Quest Log Window's Close button can use the Text Table. The Quest Log Window's default "No active quests" and "No completed quests" content can also use the Text Table.
Conversations and quest descriptions themselves don't use text tables. They use the localization that's inside the dialogue database.
UI elements like the dialogue UI's Continue button and the Quest Log Window's Close button can use the Text Table. The Quest Log Window's default "No active quests" and "No completed quests" content can also use the Text Table.
Conversations and quest descriptions themselves don't use text tables. They use the localization that's inside the dialogue database.
Re: Really vague localization question
Thanks Tony
Finally got my head around this.
Thanks for your patience.
Nathan
Finally got my head around this.
Thanks for your patience.
Nathan
Re: Really vague localization question
No worries! Localization is a bit piecemeal, being spread across text tables and dialogue databases, but I swear there's a logic to it.
Re: Really vague localization question
Ya, I can see the logic to it and it makes complete sense for using it the way it’s intended. I’m just trying to make it do something a bit different. Luckily Dialogue System once again proves to be robust enough to make obscure requests possible with relative ease.
Nathan
Nathan