SysDVR icon indicating copy to clipboard operation
SysDVR copied to clipboard

Looking for translators

Open exelix11 opened this issue 1 year ago • 28 comments

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 avatar Jan 15 '24 12:01 exelix11

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

sskyNS avatar Jan 15 '24 12:01 sskyNS

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

THZoria avatar Jan 15 '24 12:01 THZoria

cc @spreedated who worked on translations in #253

exelix11 avatar Jan 15 '24 12:01 exelix11

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.

spreedated avatar Jan 15 '24 12:01 spreedated

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.

exelix11 avatar Jan 15 '24 12:01 exelix11

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.

spreedated avatar Jan 15 '24 12:01 spreedated

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.

exelix11 avatar Jan 15 '24 13:01 exelix11

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!

spreedated avatar Jan 15 '24 14:01 spreedated

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.

exelix11 avatar Jan 15 '24 14:01 exelix11

pl-PL here if needed!

DarrenWarrenV avatar Jan 15 '24 17:01 DarrenWarrenV

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.

exelix11 avatar Jan 15 '24 17:01 exelix11

No objections and instant help if needed.

DarrenWarrenV avatar Jan 15 '24 18:01 DarrenWarrenV

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.

spreedated avatar Jan 15 '24 18:01 spreedated

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 avatar Jan 15 '24 19:01 exelix11

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.

exelix11 avatar Jan 19 '24 17:01 exelix11

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.

spreedated avatar Jan 24 '24 19:01 spreedated

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

exelix11 avatar Jan 24 '24 19:01 exelix11

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.

exelix11 avatar Jan 24 '24 20:01 exelix11

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:

https://github.com/exelix11/SysDVR/pull/267/commits/cf0c751e3c0fe4bf2b404192e133d505a95f8aa2

spreedated avatar Jan 24 '24 22:01 spreedated

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 avatar Jan 26 '24 19:01 exelix11

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

exelix11 avatar Jan 27 '24 18:01 exelix11

I can help with the translation into Russian

teuchezh avatar Feb 01 '24 12:02 teuchezh

I can help with the spanish translation

ar1810 avatar Feb 06 '24 02:02 ar1810

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

github-actions[bot] avatar Mar 10 '24 00:03 github-actions[bot]

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:

  • PC client: https://github.com/exelix11/SysDVR/blob/master/Client/Platform/Resources/resources/strings/english.json
  • Console settings app: https://github.com/exelix11/SysDVR/blob/master/SysDVRConfig/romfs/strings/english.json

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: https://github.com/exelix11/SysDVR/commit/406199845613c3e87958fded7af6e272fbd04c72#diff-5815bfc9da2e5f091a0e5ace0807c764709d073a1db152be041946d90048259a

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

exelix11 avatar Apr 13 '24 09:04 exelix11

I can help with the brazilian portuguese translation 😄

discollizard avatar Jun 06 '24 02:06 discollizard