AonaSuzutsuki / SavannahManager

Server manager for 7Days To Die.
https://kimamalab.azurewebsites.net/software/7dtdsvmanager_en.aspx
MIT License
11 stars 4 forks source link

Help me #3

Closed Shuazijun closed 3 years ago

Shuazijun commented 4 years ago

图片 How to add language files correctly and display them?

AonaSuzutsuki commented 4 years ago

the language has not automatically added to the menu. therefore, you need to create and compile the XAML file and language files to add it. i didn't predicted adding it to the new one.

Lanugage Files

  1. copy the resx file in English or Japanese * add the language code to the end. (exp: Resource.es-ES.resx)
  2. edit the resx file you copied

ResourceService

  1. add a language code same as "Lanugage Files" to "#region Static Members".
    public const string Spanish = "es-ES";

View & ViewModel

  1. add elements to MainWindow.xaml in the same way as in English and Japanese. * command can be changed to your likinga
  2. add command and method to "MainWindowViewModel".
  3. pass "ResourceService.{LanguageName}" to "model.ChangeCulture" and run it
    model.ChangeCulture(ResourceService.Spanish);
    model.RefreshLabels();