inkle / inkle/ink-unity-integration
Retreiving text id (`"#n": "g-x"`) at runtime for localisation
- Dominant language
- C#
- Stars
- 716
- Forks
- 115
- PR merge metrics
- No merged PRs in 30d
Description
First off, just wanted to say thanks a lot for this amazing tool, we have been using it in our upcoming game [Hermit](https://store.steampowered.com/app/1773740/Hermit_an_Underwater_Tale/), and it is just awesome to handle dialogues!
The one thing I am a big concerned about is localisation. After reading a lot of opinions I came to the conclusion that avoiding inline variables, using ids for each line and pairing this with a dictionary would be the way to go ([here](https://klaudiabronowicka.com/blog/2020-12-22-making-a-visual-novel-with-unity-5-5-localization/), [here](https://johnnemann.medium.com/localizing-ink-with-unity-42a4cf3590f3) and inkle/ink#529).
I am not entirely convinced by the solutions provided in the linked articles to create these IDs though.
Looking at the generated `.json`, it seems like every text line already contains a tag, something of the sorts of `"#n": "g-3"`. Pair this with the current knot and this creates a unique ID.
My question is thus:
**Is it possible to retrieve this g-tag at runtime?**
I'm thinking about something of the like of `story.currentID` (which does not exists).
I wouldn't mind adding this to the integration, but not sure where to do it.
In `JsonSerialisation.cs` I saw the [lines](https://github.com/inkle/ink-unity-integration/blob/7145be563063573e71750fe6777009ab885f57c9/Packages/Ink/InkLibs/InkRuntime/JsonSerialisation.cs#L578)
```csharp
if (keyVal.Key == "#n")
container.name = keyVal.Value.ToString ();
```
But I haven't been able to figure out how the tag is then used.
Extracting all the lines from the `json` should be easy enough if that part is possible.
Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.