Skip to content

Commit

Permalink
Implement and Document Localization (#326)
Browse files Browse the repository at this point in the history
* Copy l10n.proj etc. from Palaso
* Update packages and fix paths
* Remove .tmx files, ignore .xlf files

* Update a l10n ID (to match identical strings) and a comment

* Include GitHub Actions workflows in the solution and rename `dotnet` GHA to `ci+cd` for clarity

* Exclude a flaky test on the platform that takes more time

* Remove some dead code
  • Loading branch information
papeh authored Oct 18, 2023
1 parent c1b1e6c commit dc230d5
Show file tree
Hide file tree
Showing 17 changed files with 281 additions and 3,154 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build, Test and Pack"
name: "Build, Test, and Pack"

on:
push:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/l10n-packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

name: Package latest l10ns

on:
push:
tags: [ v* ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-package-l10ns
cancel-in-progress: true

jobs:

package-l10n:
strategy:
fail-fast: false
runs-on: windows-2019

steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
dotnet-version: 5.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe (Windows OS)
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # So the PATH can be set by this step

- name: Install Crowdin cli
run: npm i -g @crowdin/cli

- name: Download localizations
working-directory: ./l10n
run: crowdin download --all -T ${{ secrets.CROWDIN_PAT }}

- name: Restore packages
run: msbuild l10n/l10n.proj /t:restore /p:Configuration=Release /p:Platform="Any CPU"

- name: Build Nuget package of localizations
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # So gitversion can set environment vars during the build
run: msbuild l10n/l10n.proj /t:PackageL10ns /p:Configuration=Release /p:Platform="Any CPU"

- name: Publish Nuget package
working-directory: ./l10n
run: dotnet nuget push *.nupkg --api-key ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }} --source https://api.nuget.org/v3/index.json
55 changes: 55 additions & 0 deletions .github/workflows/l10n-source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

name: Update l10n Source Strings

on:
push:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-update-l10n
cancel-in-progress: true

jobs:

extract-and-upload-strings:
strategy:
fail-fast: false
runs-on: windows-2019

steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
dotnet-version: 5.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe (Windows OS)
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # So the PATH can be set by this step

- name: Install Crowdin cli
run: npm i -g @crowdin/cli

- name: Download Chorus.en.xlf source file # new strings will be merged into the existing file
working-directory: ./l10n
run: crowdin download sources -T ${{ secrets.CROWDIN_PAT }}

- name: Restore packages
run: msbuild l10n/l10n.proj /t:restore /p:Configuration=Release /p:Platform="Any CPU"

- name: Update l10n strings
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # So gitversion can set environment vars during the build
run: msbuild l10n/l10n.proj /t:UpdateCrowdin /p:Configuration=Release /p:Platform="Any CPU"

- name: Upload Chorus.en.xlf source file
working-directory: ./l10n
run: crowdin upload sources -T ${{ secrets.CROWDIN_PAT }}
2 changes: 1 addition & 1 deletion .github/workflows/test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Test Results

on:
workflow_run:
workflows: ["Build, Test and Pack"]
workflows: ["Build, Test, and Pack"]
types:
- completed

Expand Down
56 changes: 22 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,45 +1,33 @@
NuGet.exe
nuget.exe
CopyToWeSay.bat
output/
obj/
_Resharper*
Debug/
DebugMono/
Release/
ReleaseMono/
_ReSharper.Chorus VS2008/
.idea/
.vs/
*.files
*.mdb
*.nupkg
*.orig
*.pidb
*.resources
*.suo
*.user
CopyToWeSayDev.bat
lib/Palaso.TestUtilities.pdb
*.userprefs
*.xlf
*~
*.pidb
Mercurial/
mercurial/
*ReSharper*
build/old
launchSettings.json
lib/$(Configuration)
*.nupkg
*.resources
*.userprefs
.vs/
src/Chorus.Tests/bin/*
src/ChorusMerge.Tests/bin/*
src/SampleApp/bin/*
CopyTo Dev WeSay.bat
MercurialExtensions/
test-results
*.mdb
src/LibChorusTests/test-results/LibChorus.Tests.csproj.test-cache
**.orig
CopyTo*WeSay*.bat
Download/
L10NSharp.dll
launchSettings.json
lib/$(Configuration)
lib/Chorus_Help.chm
Mercurial/
mercurial/
MercurialExtensions/
NuGet.exe
nuget.exe
obj/
output/
packages/
.idea/
.vs/
riderModule.iml
/bin/
src/LibChorus/icu4c.readme.txt
*.files
test-results
19 changes: 15 additions & 4 deletions Chorus.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30709.132
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibChorus", "src\LibChorus\LibChorus.csproj", "{94245366-8F1E-475C-810D-FE89BB3948E0}"
EndProject
Expand Down Expand Up @@ -33,10 +33,18 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{164F4259-01F4-4F77-8E29-B768437210C3}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
GitVersion.yml = GitVersion.yml
README.md = README.md
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
GitVersion.yml = GitVersion.yml
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github-workflows", ".github-workflows", "{D0B220CC-BFF9-4E5A-99C1-042597A7AE24}"
ProjectSection(SolutionItems) = preProject
.github\workflows\l10n-packaging.yml = .github\workflows\l10n-packaging.yml
.github\workflows\ci+cd.yml = .github\workflows\ci+cd.yml
.github\workflows\l10n-source.yml = .github\workflows\l10n-source.yml
.github\workflows\test-results.yml = .github\workflows\test-results.yml
EndProjectSection
EndProject
Global
Expand Down Expand Up @@ -95,6 +103,9 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D0B220CC-BFF9-4E5A-99C1-042597A7AE24} = {164F4259-01F4-4F77-8E29-B768437210C3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {42350D12-26EB-4C72-B65E-F01D4091CBF7}
EndGlobalSection
Expand Down
Loading

0 comments on commit dc230d5

Please sign in to comment.