Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looking for translators #261

Open
exelix11 opened this issue Jan 15, 2024 · 25 comments
Open

Looking for translators #261

exelix11 opened this issue Jan 15, 2024 · 25 comments
Labels

Comments

@exelix11
Copy link
Owner

Multiple users requested the ability to localize this project in their own native languages.
I'm planning to implement this feature for the next release and as such i'm gathering people interested in translating this application.

I'm opening this before starting work on this feature to gather feedback on how many people are interested in providing translations and any suggestions before i take a fatally wrong design decision. If you are interested reply here with the language(s) you are willing to add support for.

I will be posting any updates directly here so if you are interested enable notifications for new posts so you can keep up with the discussion.

The way i'm planning to implement this right now is the following:

  • Each language will have its own json file in the resources folder so translators can work on it without recompiling the application
  • Translators will be able to include a custom font to support alphabets that are not included in the built-in open sans font
    • Only fonts with a permissive license will be allowed since they will be distributed as part of the release package
  • Most of the GUI will be able to be translated, for ease of providing support or finding bugs, debug and internal error messages will remain in english. .NET exceptions such as connection errors are already translated by the operating system itself.
@exelix11 exelix11 pinned this issue Jan 15, 2024
@sskyNS
Copy link

sskyNS commented Jan 15, 2024

Good job bro! I can provide translation contributions in Simplified Chinese(zh-CN) and Traditional Chinese(zh-TW)~

@THZoria
Copy link

THZoria commented Jan 15, 2024

Very good idea, my team on discord would be ready to work for the French part ^^

@exelix11
Copy link
Owner Author

cc @spreedated who worked on translations in #253

@spreedated
Copy link
Contributor

My fork is still up and running.
Technically you have some choices to provide localization. Via JSON is only one, another common is an INI File or XML, actually any Textfile will do.
I used the built-in Microsoft method of Globalization Namespace.

@exelix11
Copy link
Owner Author

Starting with 6.0 the new GUI also builds for mac, linux and android making Windows projects specific stuff like resx either unapplicable or a pain to use which is why i was proposing jsons. Android in particular is a very annoying platform to support properly.

Most notably we lose winforms magic font support that just works and have to manually manage fonts and character ranges. This is the reason why localization didn't make it into the 6.0 release.

@spreedated
Copy link
Contributor

Indeed, I share your view on this one and I guess an XML style or JSON is the best practice approach for it.
I'm not aware of any preexisting libraries for JSON localization, but doing it on your own isn't that difficult.
I would go with a separate project to implement the localization logic, plus I'm not sure about the existing GUI design pattern, but an implementation on MVVM should be easy when the bindable and observable properties are used correctly.

However, I'm way too technical here, as for the translators, I could provide translation in German and Polish.

@exelix11
Copy link
Owner Author

exelix11 commented Jan 15, 2024

As for design, we are constrained by the lowest common denominator for cross platform.
In particular on desktop I use AOT to build framework-less binaries (so no reflection) and on android the same to build as a dynamic library I can call from Java.

Essentially, the application is a console app with sdl and imgui, which is an immediate mode gui that runs in a loop, kinda like a game engine.

Such is the unfortunate state of cross platform user interfaces that are not a web browser.

@spreedated
Copy link
Contributor

Depending on which platforms you aim for, MAUI (former XAMARIN) is also a good approach, it aims at MVVM which implies cross-platform compatibility by strict encapsulation. AOT is common all over the .NET framework anyways and native Java library is used in the android part of MAUI.

However, with your approach using SDL/OpenGL makes it somehow independent and more versatile, but also more work to do since you have to build the layout, pages, behaviors (which imgui helps alot with) etc. yourself, also the architecture of the application.

Tbh, I am not familiar with the latest state of the project and I just saw that you released 6.0 last week so I'll definitely give it a shot. Keep up the good work!

@exelix11
Copy link
Owner Author

Last time i tried MAUI it did not feel stable yet, i did considering trying UNO or Avalonia though. The main problem that made me pick SDL in the end is the video renderer.

Truns out there is no "batteries included" library that allows playing raw video data without a proper container so i had to manually use ffmpeg which produces a framebuffer for each frame decoded. SDL gives me the low level flexibility of making a double buffered GPU renderer that does not allocate memory for each frame, other WPF-like frameworks did not seem to support this in a cross-platform way at the time i looked into it.

@DarrenWarrenV
Copy link

pl-PL here if needed!

@exelix11
Copy link
Owner Author

I made some initial work in the translation-support branch. This is still experimental, do not start translating yet.

Translation files will look like this:

{
  "translationName": "English",
  "translationAuthor": "SysDVR",
  "systemLocale": [
    "en-us"
  ],
  "imGuiGlyphRange": "Default",  // optional
  "fontName": "OpenSans.ttf", // optional
  "mainGUI_ChannelLabel": "Select the streaming mode",
  "mainGUI_ChannelVideo": "Video only",
  "mainGUI_ChannelAudio": "Audio only",
  // etc...
}

Of particular interest are the imGuiGlyphRange and fontName fields. These can be used to add support for other alphabets. In particular the first field must be one of these values and the latter the name of a font file to be embedded in the resources folder.

The systemLocale array contains which system locales are covered by this file so on first launch sysdvr will already match the system language, users will still be able to change it from the settings.

To be included in SysDVR, fonts will have to be distributed under an open license, a good example is Google Noto which seems to implement most alphabets.

Any objections to this design ?

Once this is done i'll start to think about what to do with the on-console settings app since that does have some text as well, but uses a different architecture.

@DarrenWarrenV
Copy link

No objections and instant help if needed.

@spreedated
Copy link
Contributor

I made some initial work in the translation-support branch. This is still experimental, do not start translating yet.

Translation files will look like this:

{
  "translationName": "English",
  "translationAuthor": "SysDVR",
  "systemLocale": [
    "en-us"
  ],
  "imGuiGlyphRange": "Default",  // optional
  "fontName": "OpenSans.ttf", // optional
  "mainGUI_ChannelLabel": "Select the streaming mode",
  "mainGUI_ChannelVideo": "Video only",
  "mainGUI_ChannelAudio": "Audio only",
  // etc...
}

Of particular interest are the imGuiGlyphRange and fontName fields. These can be used to add support for other alphabets. In particular the first field must be one of these values and the latter the name of a font file to be embedded in the resources folder.

The systemLocale array contains which system locales are covered by this file so on first launch sysdvr will already match the system language, users will still be able to change it from the settings.

To be included in SysDVR, fonts will have to be distributed under an open license, a good example is Google Noto which seems to implement most alphabets.

Any objections to this design ?

Once this is done i'll start to think about what to do with the on-console settings app since that does have some text as well, but uses a different architecture.

Just my two cents, but instead of using prefixes for the categories, we could use objects.

{
"localeInfo":
{
  "author": "SysDVR",
  "imGuiGlyphRange": "Default",  // optional
  "fontName": "OpenSans.ttf" // optional
},
"localization": 
 {
  "mainGui": 
                    {
                            "channelLabel": "Select the streaming mode",
                            "channelVideo": "Video only",
                            "channelAudio": "Audio only"
                    },
  "settings": 
                    {
                            "settings": "Settings",
                    }
//etc.
 }
}

Another thing about encapsulation comes to the locale array; imho it's better to have separate files for each locale and named it properly inside the locale folder like "en-US.json" "de-DE.json" etc. (filenaming by languagecode) so they can be identified this way.

@exelix11
Copy link
Owner Author

I figured one might want the same language file for multiple locales, on start the app will load all the jsons (deserializing only the metadat fields) and pick the matching locale.

As for encapsulation, I'll think about it, don't see any real advantage cause I can't use fancy techniques like dependency injection or auto mapping to pages. Meant the prefixes as context for translators cause I happened to do some software translating and the lack of context in string files reduces the overall quality if the translator is not paying attention.

@exelix11
Copy link
Owner Author

exelix11 commented Jan 19, 2024

Translation support is now functional for the client, you can find the default strings file in https://github.com/exelix11/SysDVR/blob/translation-support/Client/Platform/Resources/resources/strings/english.json

You can submit a pull request to the translation-support branch or just provide your translated file here or on discord.
To test your translations you can get a build from github actions https://github.com/exelix11/SysDVR/actions/runs/7586908510 and add your custom json file in Resources\strings

Let me know if any issue pops up., in the meantime i'll look into adding translation support to the console settings app as well.

@spreedated
Copy link
Contributor

SysDVR-Client.exe (process 22988) exited with code -1073740940

Happens 6/10 times trying to debug.
There seems to be an AccessViolationExcpetion in Line 81 of ImFontGlyphRangesBuilder.gen.cs.

public void Clear()
{
    ImGuiNative.ImFontGlyphRangesBuilder_Clear((ImFontGlyphRangesBuilder*)(NativePtr));
}

Maybe NativePtr didn't got initialized correctly or pointed to a read/write protected part of the memory.

@exelix11
Copy link
Owner Author

Are you using latest commit ? i think I fixed this already. Also provide a stack trace of the crash.

@exelix11
Copy link
Owner Author

Re-reading the code it may also be non zeroed memory in the font builder constructor, but it's weird it didn't trip at all for me during development on both windows and android.

I'll look into it but not before this weekend as I'm busy irl.

@spreedated
Copy link
Contributor

image

Okay, I think I fixed it by changing the MemAlloc to the ImGui native GlyphRangesBuilder.
By testing, 10/10 times runs normally :)

You can find it within my PR for the german translation:

cf0c751

@exelix11
Copy link
Owner Author

only now found some time to look at your fix, I had completely missed that cimgui exposed a wrapper for the constructor. I did some debugging and the issue was indeed not zeroing memory but your fix is probably better.

@exelix11
Copy link
Owner Author

I just added translation support for the on-console settings app, you can find the strings json file here: https://github.com/exelix11/SysDVR/blob/translation-support/SysDVRConfig/romfs/strings/english.json

@teuchezh
Copy link

teuchezh commented Feb 1, 2024

I can help with the translation into Russian

@ar1810
Copy link

ar1810 commented Feb 6, 2024

I can help with the spanish translation

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Mar 10, 2024
@exelix11 exelix11 added todo and removed stale labels Mar 21, 2024
@exelix11
Copy link
Owner Author

exelix11 commented Apr 13, 2024

I'm planning to release v6.1 in a week or two. If anyone is working on a translation please let me know so i can plan the release accordingly.

The hopefully definitive files to translate are:

For the people who already submitted a translation i'd like a quick update for a few strings i added recently, see the diff with the new strings here: 4061998#diff-5815bfc9da2e5f091a0e5ace0807c764709d073a1db152be041946d90048259a

I think only @spreedated is on github, the others DM'd me on discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants