FFXIVAPP / ffxivapp

Visit us on Discord! https://discord.gg/aCzSANp
https://xivapp.com
MIT License
89 stars 45 forks source link

Help translate the app. #55

Open Yaguar666 opened 9 years ago

Yaguar666 commented 9 years ago

Hi Ryan! I need your help. I try to translate into Russian FFXIVAPP. Already translated and added similar components in the file: 2015-06-01_112145

Created and filled file Russian.cs

Translated and recompile: FFXIVAPP.Localization.dll FFXIVAPP.Common.dll FFXIVAPP.IPluginInterface.dll

I recompile FFXIVAPP, but can be seen only after the launch icon and explanation when it leads to the mouse cursor. Pressing the language is changed to English. All other languages ​​work.

More plug-ins are no longer installed.

Just a test plug in unmodified FFXIVAPP, after installation and restart APP, remains in the "unidentified".

Is there any function to APP writing error, etc. a file? And it would be desirable to understand)

Yaguar666 commented 9 years ago

And what are it doing:

catch (Exception ex) ?

Icehunter commented 9 years ago

When it comes to localization the application used to have two separate settings.

It was at the time however; confusing for users because they would set the UI language and not set the Game Language. They would assume the program did not work.

I consolidated those two and the way it works now is when you click the Icon for the language at the top, it will set the game language to the same thing.

In this case the default work flow is that if you added a Russian flag to the top, and then click it. It would try and set the game language to Russian (which of course is not available at this time).

Each plugin also exposes a list of supported languages as well. As an example found here:

https://github.com/cjmanca/FFXIVDBM.Plugin/blob/master/FFXIVDBM.Plugin/Constants.cs#L46

It's used by code like this:

https://github.com/Icehunter/ffxivapp-plugin-parse/blob/master/FFXIVAPP.Plugin.Parse/Helpers/LocaleHelper.cs#L48

If the language isn't supported it will default to English.

With the new plugin changes I did I also don't use that localization library anymore and they are all now contained in named locale files inside the plugin.

The catch right now is just for catching errors but it can be logged use the NLog viewer.

Setup can be found here: http://ffxiv-app.com/topic/22/about-ffxivapp/3

Yaguar666 commented 9 years ago

Yeah. Hmm, and yet possible to make only the language of UI has changed, and the language of the game remained, say, English? Where can I edit the code?

Change, for example, Settings.Default.GameLanguage = "en" and UILanguage = "ru"?

Icehunter commented 9 years ago

It's not quite as simple as that; because for the UI to update it's tied to GameLanguage.

Let me see if there's something more I can do in the main app to allow this and make it work appropriately. Such as choosing a non-game language can request a UI update but default to a game language of English.

Yaguar666 commented 9 years ago

Hello again. It turned out to change something?

Yaguar666 commented 9 years ago

I found an annoying bug in the code in App.cs that prevented the localization of applications. I forgot to add "ru":

                case "GameLanguage":
                    Constants.GameLanguage = Settings.Default.GameLanguage;
                    var lang = Settings.Default.GameLanguage.ToLower();
                    var cultureInfo = new CultureInfo("en");
                    switch (lang)
                    {
                        case "french":
                            cultureInfo = new CultureInfo("fr");
                            break;
                        case "japanese":
                            cultureInfo = new CultureInfo("ja");
                            break;
                        case "german":
                            cultureInfo = new CultureInfo("de");
                            break;
                        case "chinese":
                            cultureInfo = new CultureInfo("zh");
                            break;
                        case "russian":
                            cultureInfo = new CultureInfo("ru");
                            break;
                    }

Now the application is localized (the part that works with a dictionary). But the plugins is "Out of date" and not working. Although I rebuilt with new plugin dll. Maybe it depends on the version?

Yaguar666 commented 9 years ago

Ah, version check was added at 3.0.5592.26103 build, ok, will try to make it work)

Yaguar666 commented 9 years ago

Is it possible to make the plugin version that is higher than the version on the server, and also passed the validation work?

Icehunter commented 9 years ago

As long as the versions of the following libraries in the plugin are not lower than what is included in the app any plugin should load.

https://github.com/Icehunter/ffxivapp/blob/master/FFXIVAPP.Client/PluginHost.cs#L91

Regarding the UI and language updates. I'll be committing code tonight that changes the language buttons at the top to a drop down. Adding a new language is pretty simple and if you want a language different than the game language that will be allowed.

I'll have more details later after I commit.

Yaguar666 commented 9 years ago

Version of libraries are simple, but: 2015-06-05_193625 2015-06-05_193644 Try to up version of Widgets.

Icehunter commented 9 years ago

If you recompiled any of those dependencies yourself they won't match the ones I released and prevent loading. if you go back to using the versions I have in the resource repo and from the released version of ffxivapp it should be fine.

Yaguar666 commented 9 years ago

I added a crutch to check the translation plugins) 2 hours - normal flight:

    private bool HostAssemblyValidation(string name, Version version)
    {
        var reference = Assembly.GetExecutingAssembly()
                                .GetReferencedAssemblies()
                                .FirstOrDefault(a => a.Name == name);
        if (reference == null)
        {
            return true;
        }
        return true;

// return version.CompareTo(reference.Version) == 0; }

Icehunter commented 9 years ago

You can change that locally if you like; but in the event something is upgrade like MahApps.Metro and the other plugins haven't updated it's going to cause the app to crash, behave badly or just show a white screen.

Yaguar666 commented 9 years ago

Yeap, it's only for test)

Yaguar666 commented 9 years ago

And what is responsible for setting the name of the plug-in, the name of the tab? 2015-06-06_171445

Icehunter commented 9 years ago

https://github.com/Icehunter/ffxivapp-plugin-parse/blob/master/FFXIVAPP.Plugin.Parse/Plugin.cs#L135

:)

Icehunter commented 9 years ago

So far it doesn't support translation at this time however. I'm looking at a way to put that in.

Yaguar666 commented 9 years ago

Tx)))) Very quick answer))) It's hard to understand someone else's code) Slowly I understand)

Ok, it would be nice.

Icehunter commented 9 years ago

Updated the main app now to support separation of game/ui updates. So you can choose another language for the UI and have a different one for the game. Message boxes will advise on updates.

Yaguar666 commented 9 years ago

Cool! ^_^ And how to from the Dictionary, depending on the language, cause the variable? For example event_RegExLabel?

Where to download the changed files that you added to your repository? 95% is already translated. ^_^

Icehunter commented 9 years ago

Here's how you add your own language:

Which reminds me... I have to add Chinese into the parser as supported lol I thought I did that already.

Yaguar666 commented 9 years ago

I was add translation in files, added translation to the libraries. I wanted to help you, and add to the possibility of translate of the objects that you have not realized. How to add to XAML files - I understood by analogy it is easy to do. But what to do with calling a variable from the dictionary for C # ... For is simply one language, but for a few I have not thought of)

Icehunter commented 9 years ago

If you're dealing with the main application you only need to reference something like this:

https://github.com/Icehunter/ffxivapp/blob/master/FFXIVAPP.Client/Views/SettingsView.xaml#L29

AppProperties is imported globally for all xaml files.

However if it's a plugin make sure to add the following line at the top:

https://github.com/Icehunter/ffxivapp-plugin-parse/blob/master/FFXIVAPP.Plugin.Parse/Views/SettingsView.xaml#L11

Then you import the PluginViewModel like so:

https://github.com/Icehunter/ffxivapp-plugin-parse/blob/master/FFXIVAPP.Plugin.Parse/Views/SettingsView.xaml#L19

After that you can use it like this:

https://github.com/Icehunter/ffxivapp-plugin-parse/blob/master/FFXIVAPP.Plugin.Parse/Views/SettingsView.xaml#L29

Yaguar666 commented 9 years ago

That's all I had to do:

https://drive.google.com/file/d/0BweYJ0oqWXvyamNIVXFBR1Jjc1E/view?usp=sharing

Somewhere there really is an error in translation, but it is fixable) And yet somehow plugins is "Out of Date".

Icehunter commented 9 years ago

Did you build own copies of any of these?

        "FFXIVAPP.Common",
        "FFXIVAPP.IPluginInterface",
        "MahApps.Metro",
        "HtmlAgilityPack",
        "NAudio",
        "Newtonsoft.Json",
        "NLog",
        "System.Windows.Interactivity"

If you did then you also have to compile the plugin with those versions. It's recommended that unless you have changes specific to something in those libraries you use the ones that came in the resources project or with the main app itself.

Yaguar666 commented 9 years ago

I changed only that main lib: "FFXIVAPP.Common", "FFXIVAPP.IPluginInterface" "FFXIVAPP.Localization" Yeap, i used changed versions for main app & plugins from the same source, but something don't work.

_<

Icehunter commented 9 years ago

Is your code pushed somewhere where I can see it; like github. I can pull the code and try to build it myself.

Yaguar666 commented 9 years ago

https://github.com/Yaguar666?tab=repositories Load all to github

Icehunter commented 9 years ago

Because you didn't fork them from github it was a little difficult to see some differences but one big difference is that the version of common.dll you use is much newer than that one I use, because of that no plugin will load until it's also compiled with that same version.

What changes did you make to common?

Yaguar666 commented 9 years ago

Reloaded. At first I loaded your files, and then changed over me now all changes at a glance)

https://github.com/Yaguar666?tab=repositories

I should not have got into the Common.dll? I just changed Localization.dll and recompile everything with which it is associated.

I recompile all over again, from Localization to plugins and plugins have earned)

Yaguar666 commented 9 years ago

Translation is almost ready, even the updated files to the 3.0. I added the possibility to localize most of the text. It remains only to translate the headings and lists of plugins. I need your help! ^ _ ^

How Do I in C # file Plugin.cs assign a variable from the dictionary? FriendlyName = Local.Dictonary ("event_FrendlyName")?

And that's where the change lists, for example: Ascending / Descending - in the plugin settings "Parse", I do not know (

Icehunter commented 9 years ago

The lists are stored in settings, rather than locale so I right now don't know how-to update that based on language as those things are saved to the users computer as well.

For the plugins you can access local I believe:

PluginViewModel.Instance.Locale["key"];