![]() |
Sunshine latest
Self-hosted game stream host for Moonlight.
|
Read our contribution guide in our organization level docs.
./src_assets/common/assets/web
.template_header.html
and template_header_main.html
).
Sunshine and related LizardByte projects are being localized into various languages. The default language is en
(English).
The translations occur on CrowdIn. Anyone is free to contribute to the localization there.
How does it work?
When a change is made to Sunshine source code, a workflow generates new translation templates that get pushed to CrowdIn automatically.
When translations are updated on CrowdIn, a push gets made to the l10n_master branch and a PR is made against the master branch. Once the PR is merged, all updated translations are part of the project and will be included in the next release.
Sunshine uses Vue I18n for localizing the UI. The following is a simple example of how to use it.
Add the string to the ./src_assets/common/assets/web/public/assets/locale/en.json
file, in English.
Use the string in the Vue component.
There should be minimal cases where strings need to be extracted from C++ source code; however it may be necessary in some situations. For example the system tray icon could be localized as it is user interfacing.
Strings are automatically extracted from the code to the locale/sunshine.po
template file. The generated file is used by CrowdIn to generate language specific template files. The file is generated using the .github/workflows/localize.yml
workflow and is run on any push event into the master
branch. Jobs are only run if any of the following paths are modified.
When testing locally it may be desirable to manually extract, initialize, update, and compile strings. Python is required for this, along with the python dependencies in the ./scripts/requirements.txt
file. Additionally, xgettext must be installed.
Source code is tested against the .clang-format
file for linting errors. The workflow file responsible for clang format testing is .github/workflows/cpp-clang-format-lint.yml
.
Option 1:
Option 2 (will modify files):
Sunshine uses Google Test for unit testing. Google Test is included in the repo as a submodule. The test sources are located in the ./tests
directory.
The tests need to be compiled into an executable, and then run. The tests are built using the normal build process, but can be disabled by setting the BUILD_TESTS
CMake option to OFF
.
To run the tests, execute the following command.
To see all available options, run the tests with the --help
flag.
We use gcovr to generate code coverage reports, and Codecov to analyze the reports for all PRs and commits.
Codecov will fail a PR if the total coverage is reduced too much, or if not enough of the diff is covered by tests. In some cases, the code cannot be covered when running the tests inside of GitHub runners. For example, any test that needs access to the GPU will not be able to run. In these cases, the coverage can be omitted by adding comments to the code. See the gcovr documentation for more information.
Even if your changes cannot be covered in the CI, we still encourage you to write the tests for them. This will allow maintainers to run the tests locally.