Skip to content

Commit

Permalink
Fix L10n Source Extraction (#1290)
Browse files Browse the repository at this point in the history
* Download the existing Palaso.en.xlf and merge into it (preserves l10n of strings w/o i18n)
* Update to the latest ExtractXliff
* Update documentation
  • Loading branch information
papeh authored Oct 9, 2023
1 parent be0aa62 commit 36b8d09
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/l10n-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@ jobs:
- name: Restore packages
run: msbuild l10n/l10n.proj /t:restore /p:Configuration=Release /p:Platform="Any CPU"

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

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

- 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: Install Crowdin cli
run: npm i -g @crowdin/cli

- name: Upload Palaso.en.xlf source file
working-directory: ./l10n
run: crowdin upload sources -T ${{ secrets.CROWDIN_PAT }} -i ${{ secrets.CROWDIN_PROJECT_ID }}
10 changes: 7 additions & 3 deletions l10n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
### Updating Crowdin with source string changes (automatic)

On each commit to `master`, a GitHub Action runs to
- Extract all internationalized strings from all libpalaso projects to `../DistFiles/Palaso.en.xlf`
- Download the current `Palaso.en.xlf` from Crowdin.
(L10NSharp.ExtractXliff version 7.0.0-beta0011 fails to extract all strings, as not all are internationalized.
Merging into the existing file is easier than fixing 128 uninternationalized strings.)
- Extract all internationalized strings from all libpalaso projects to `Palaso.en.xlf`
- Upload Palaso.en.xlf to [Crowdin](https://crowdin.com/project/sil-common-libraries)

See `../.github/workflows/l10n-source.yml`

It can also be run manually as follows:
It can also be run manually as follows (requires the [Crowdin CLI](https://crowdin.github.io/crowdin-cli/)):
```
crowdin download sources -i CROWDIN_PROJECT_ID -T CROWDIN_ACCESS_TOKEN
msbuild l10n.proj /t:UpdateCrowdin
crowdin upload sources -i CROWDIN_PROJECT_ID -T CROWDIN_ACCESS_TOKEN
```
Expand All @@ -24,7 +28,7 @@ crowdin upload sources -i CROWDIN_PROJECT_ID -T CROWDIN_ACCESS_TOKEN
This process is run by a github action whenever a version tag is pushed and manually as needed
(See `../.github/workflows/l10n-packaging.yml`)

It can also be run manually on a developer machine as follows:
It can also be run manually as follows (requires the [Crowdin CLI](https://crowdin.github.io/crowdin-cli/)):
```
crowdin download --all -i CROWDIN_PROJECT_ID -T CROWDIN_ACCESS_TOKEN
msbuild l10n.proj /t:PackageL10ns
Expand Down
6 changes: 0 additions & 6 deletions l10n/crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#
# Your crowdin's credentials
#
base_path : "."
preserve_hierarchy: true

#
# Files configuration
#
files: [
{
"source" : "Palaso.en.xlf",
Expand Down
4 changes: 2 additions & 2 deletions l10n/l10n.proj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="$(NuGetPackageRoot)\gitversion.msbuild\build\GitVersion.MsBuild.targets" Condition="Exists('$(PkgGitVersion_GitVersion_MsBuild)\build\GitVersion.MsBuild.targets')" />
<PropertyGroup>
<TargetFrameworks/>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netframework4.8</TargetFramework>
<PackageId>SIL.libpalaso.l10ns</PackageId>
<Version>$(GitVersion_NuGetVersion)</Version>
<Authors>Jason Naylor</Authors>
Expand All @@ -15,7 +15,7 @@
<PackageReference Include="GitVersion.MsBuild" Version="5.9.0" GeneratePathProperty="true">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="L10NSharp.ExtractXliff" Version="5.0.0-beta0080" GeneratePathProperty="true" />
<PackageReference Include="L10NSharp.ExtractXliff" Version="7.0.0-beta0011" GeneratePathProperty="true" />
<PackageReference Include="NuGet.CommandLine" Version="6.1.0" GeneratePathProperty="true" />
<PackageReference Include="SIL.BuildTasks" Version="2.3.0-beta.14" GeneratePathProperty="true" />
</ItemGroup>
Expand Down

0 comments on commit 36b8d09

Please sign in to comment.