jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

Multi language support (Localisation) #40

Open SaltPepp opened 8 years ago

SaltPepp commented 8 years ago

In the future, we will need to read server messages from a language config file. That way people can translate the messages eg error messages to their language that they read and write.

midspace commented 8 years ago

There isn't localization support for Mods currently, only of resources within Space Engineers. We can access those currently. The other issue is, where to deal with localization, as we will be carrying out a fair amount of processing on the Server, and that either means forming the message string on the server in the player's selected localization to send back, or sending back the message context, and building the message string on the player's clients in their localization.

Issue https://github.com/jpcsupplies/Economy_mod/issues/5, in the Seen update we will have to pass the last Localization used by a Player to the Server also, so any offline messages are formed correctly.

jpcsupplies commented 8 years ago

I think we can not worry about this too much, the only localisation we realistically need is on the manual page, although our mod is basically english; the commands are basic enough that if someone pushes the current manual through google translate they should have no trouble. I think the mod is searching on item names as reported to it by the game anyway, which itself will be automatically localising them anyway, The only way we could conceivable improve on that is creating a bunch of alternate buy/sell commands in a variety of languages and keyboard maps and adding them to our command list. Potentially we could create a xml file that allows admins to localise it themself..

eg.. command to listen for, command to processes when that command used

eg.

french acheter vendre prix valeur

when a french player types /prix the plugin checks the alias list, sees it relates to "/price" command and executes that code.

realistically this creates an entire bucket of annoying issues such as rewriting our command catch engine to compare to a list and execute the correct routine, which for the time/benefit ratio is not really worth it.

The new logic would need to be something like a regex that checks each command starts with / then looks up the first string in an xml list, and then passes all the parameters typed in via the regix to a routine for that function. It would require a time consuming rewrite of the entire plugin for only minor benefit.

midspace commented 8 years ago

I'm re-opening this, mostly for my own self gratification, but also because I think we get get more people using this mod if we can at least cater to their language. I say this because I've just discovered that the Server code does not offer any localization whatsoever. The game when it starts - both Client and Server - explicitly sets the CultureInfo to Invariant. That means, that it isn't even using OS defaults. It's really raw formats. We're just lucky that the formatting is at least somewhat similar to those used in English speaking countries that we can understand it.

midspace commented 8 years ago

By setting the Language in the Config, the Server language can be applied. Notice that Client language is NOT affected, but LCD's that are composed by the Server are.

<EconConfig xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Language>4</Language>

2015-12-13_00001

jpcsupplies commented 8 years ago

Ah, nice. So how would the end user/admin make use of this (or rather how do i describe it in the manual!)

midspace commented 8 years ago

We will have to add a command to change Configuration values at some stage.

Currently: The Space Engineers Dedicated Server by default do not have a language. By setting the Language in the Economy Config, a language can be applied to a Dedicated Server. Note that Client language is NOT affected by this, but LCD's that are composed by the Server are.

Modify your Economy Config file to add the <Language> element if it doesn't already have one as per below.

<EconConfig xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Language>4</Language>

The following values are the only values accepted by the game.

English = 0, Czech = 1, Slovak = 2, German = 3, Russian = 4, Spanish_Spain = 5, French = 6, Italian = 7, Danish = 8, Dutch = 9, Icelandic = 10, Polish = 11, Finnish = 12, Hungarian = 13, Portuguese_Brazil = 14, Estonian = 15, Norwegian = 16, Spanish_HispanicAmerica = 17, Swedish = 18, Catalan = 19, Croatian = 20, Romanian = 21, Ukrainian = 22, Turkish = 23, Latvian = 24

jpcsupplies commented 8 years ago

for configuring in game - /set language X or /set lcd X ??

jpcsupplies commented 8 years ago

ive also added the localisation notes to steam guide

midspace commented 8 years ago

I've removed the Chinese. It used to be in the old SE code. It's no longer there in current SE code.

We need a general config command. more like.

/econfig - Display current settings. /econfig language 4 - change language to 4. /econfig language en - change language to 0 (after some detection). /econfig TradeNetworkName Federated Terran Empire - change the TradeNetworkName /econfig LimitedRange off - change LimitedRange off. /econfig TradeTimeout 00:00:01 - change TradeTimeout to 1 second. /econfig DefaultStartingBalance 5000 - change DefaultStartingBalance to 5000.

This should probably be part of #88

jpcsupplies commented 8 years ago

so keep set for stock related stuff, and econfig for behavioural settings basically? That could work.