Skip to content

Conversation

@t0stiman
Copy link
Collaborator

@t0stiman t0stiman commented May 29, 2025

  • added ability to translate station names
  • fixed "Failed to find locale language" warning (it reported the wrong language)
  • added more languages and credited the translators

Fixes #107

(This is a reopening of #108)

Copy link
Owner

@Insprill Insprill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are map-specific locales supposed to be created? I don't see anything changed on the editor side.

Create locale.csv in the same folder as info,json of the map. For example:
locale.csv

You aren't supposed to ever create the zip manually though, when you build the map from the editor that should be the zip you distribute. There needs to be good editor tooling for creating localizations.

How much work would be involved with switching to the localization library most other mods now use? I think that would be a better route than continuing to reinvent the wheel, assuming it covers all our needs.


(this discussion was originally in a comment on #108)

@t0stiman
Copy link
Collaborator Author

There needs to be good editor tooling for creating localizations.

Yes, that would be ideal. However, that would take more effort to make then I am currently willing to invest in this feature.

@Insprill
Copy link
Owner

How about switching to Language Helper? I haven't worked with it before, so I'm unsure how much work would be involved. If we do that, map creators could then just provide a link to a Google sheet in MapInfo, and we wouldn't have to worry about custom tooling or maintaining our own language implementation.

@t0stiman
Copy link
Collaborator Author

Now it uses language helper. Not just for the map-specific translations but also just Mapify.

Specifiying translations works like the cargo in and outputs:

afbeelding

@t0stiman
Copy link
Collaborator Author

Fun fact: I was wondering why the you made CargoSetMonoBehaviour... And then I had to do the same xD

@WhistleWiz
Copy link
Collaborator

Using a MonoBehaviour for this is unnecessary. You can serialize to a string in either XML or JSON and deserialize after importing:
https://github.com/derail-valley-modding/custom-car-loader/blob/ea44c611a6e03160aa62e5e6b4b54d73d8942719/CCL.Types/Components/ShaderGrabber.cs#L33

@t0stiman
Copy link
Collaborator Author

t0stiman commented Jun 13, 2025

Using a MonoBehaviour for this is unnecessary. You can serialize to a string in either XML or JSON and deserialize after importing:

Eh, but then we'd have to add the JSONObject library. I'd rather keep it as it is for now, it just works™

@WhistleWiz
Copy link
Collaborator

WhistleWiz commented Jun 13, 2025

You don't need to, you can use the built-in XML serializer, or reference the same package DV already includes (JSONObject is just a wrapper over those for utility I believe).

@Insprill
Copy link
Owner

The MonoBehaviour hack is good when you need references to GameObjects or assets, but since this is simple data, it's easier/more reliable to use Wiz's approach.

We already do the json thing for streaming scenes using Unity's JsonUtility.

[Serializable]
public class SceneSplitData
{
public string[] names;
public int xSize;
public int ySize;
public int zSize;
// Not sure *exactly* what these do but this is what DV sets them to ¯\_(ツ)_/¯
public int xLimitsy = 15;
public int zLimitsy = 15;
}

SceneSplitData splitData = SceneSplitter.SplitScene(scenes.streamingScene, Scenes.STREAMING_DIR, mapInfo);
mapInfo.sceneSplitData = JsonUtility.ToJson(splitData);

SceneCollection collection = streamerObj.AddComponent<SceneCollection>();
JsonUtility.FromJsonOverwrite(mapInfo.sceneSplitData, collection);

@Insprill
Copy link
Owner

It'd be nice to get this merged soon; the only thing blocking is the MonoBehaviour vs JSON thing. I'm more in favor of switching to JSON. Are there any arguments against it, or anything in particular blocking this?

@t0stiman
Copy link
Collaborator Author

I tried to implement the JSON method, but it didn't work. I could give it another go some time

@t0stiman
Copy link
Collaborator Author

This branch is borked by build 99.7, needs fixing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to translate station names

3 participants