Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/build_loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ on:
# affect other OS apps if run simultaneously.
# Each OS needs a time of day distinct from other apps, LoopWorkspace uses 9 every Wed and 7 every 1st of month
schedule:
- cron: "0 9 * * 3" # Checks for updates at 09:00 UTC every Wednesday
- cron: "0 7 1 * *" # Builds the app on the 1st of every month at 07:00 UTC
# avoid starting an action at hh:00 when GitHub resources are impacted
- cron: "33 9 * * 3" # Checks for updates at 09:33 UTC every Wednesday
- cron: "33 7 1 * *" # Builds the app on the 1st of every month at 07:33 UTC

env:
UPSTREAM_REPO: LoopKit/LoopWorkspace
Expand Down Expand Up @@ -200,7 +201,7 @@ jobs:
| # runs if started manually, or if sync schedule is set and enabled and scheduled on the first Saturday each month, or if sync schedule is set and enabled and new commits were found
github.event_name == 'workflow_dispatch' ||
(needs.check_alive_and_permissions.outputs.WORKFLOW_PERMISSION == 'true' &&
(vars.SCHEDULED_BUILD != 'false' && github.event.schedule == '0 7 1 * *') ||
(vars.SCHEDULED_BUILD != 'false' && github.event.schedule == '33 7 1 * *') ||
(vars.SCHEDULED_SYNC != 'false' && needs.check_latest_from_upstream.outputs.NEW_COMMITS == 'true' )
)
steps:
Expand Down
2 changes: 1 addition & 1 deletion G7SensorKit
18 changes: 18 additions & 0 deletions LoopWorkspace.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

216 changes: 216 additions & 0 deletions Scripts/LocalizationInstructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
## Manual Localization Instructions

> This is work-in-progress. There are some open questions on how to deal with certain strings.

There are several scripts to automate the localization process. However, these localization scripts require access to tokens:

* export_localizations.sh
* import_localizations.sh

If access to these tokens is not available, but a user is a manager for the Loop project at lokalise, they can manually take those actions.

New scripts were created to provide a step-by-step manual process:

* manual_export_localizations.sh
* manual_import_localizations.sh
* manual_review_translations.sh
* manual_translations_finalize.sh

The summary action for these script is provided here, with details in the [Usage](#usage) section.

#### manual_export_localizations

* script to create xliff_out folder with xliff files in all languages suitable to drag and drop into lokalise

#### manual_import_localizations

* script to import from xliff_in folder
* create `translations` branch for each project
* command-line Xcode build before importing xliff files
* command-line Xcode build for each language importing from the associated xliff file
* after completion, LoopWorkspace has uncommitted changes in projects

#### manual_review_translations

* script to make it easy to review changes per submodule, shows diffs, and pause so manual modifications can be enacted if appropriate

#### manual_translations_finalize

* script to commit the change for each project folder (submodule)
* if there are no changes, no action is taken
* if there are changes
* git add .; commit all with automated message
* push the `translations` branch to origin
* create a PR from `translations` branch to default branch for that repository
* open the URL for the PR

## Usage

### Loop Dashboard at localise

When you log into the [lokalise portal](https://app.lokalise.com/projects) navigate to the Loop dashboard, you see all the languages and the % complete for translation.

#### Open questions

> Notes from Marion Barker:

##### Question 1:

I do not believe these keys should be included in the translation process:

* CFBundleGetInfoString
* CFBundleNames
* NSHumanReadableCopyright

These were almost all empty. I deleted these keys on 2025-07-27 on the lokalise site.

A few of them did have entries for some languages

* I have them archived locally and can restore them if they should have been kept

When uploading a new set of xliff_out files, they are recreated - so I think I'm missing a method to limit them.

Note that in the xliff files, these say translate="no", so why do they show up in the imported list on lokalise?

I will keep looking for help in the documentation, but if anyone knows - let me know.

Because of this uncertainty, I only modified the LibreTransmitter project so far because there is a hotfix needed for it.

##### Question 2:

A lot of the changes that were proposed were white space changes.

Here's an example:

```
diff --git a/RileyLinkKitUI/nb.lproj/Localizable.strings b/RileyLinkKitUI/nb.lproj/Localizable.strings
index fbfc31e..db53cbd 100644
--- a/RileyLinkKitUI/nb.lproj/Localizable.strings
+++ b/RileyLinkKitUI/nb.lproj/Localizable.strings
@@ -74,7 +74,7 @@
"Name" = "Navn";

/* Detail text when battery alert disabled.
- Text indicating LED Mode is off */
+Text indicating LED Mode is off */
"Off" = "Av";

/* Text indicating LED Mode is on */
@@ -87,7 +87,7 @@
"Signal Strength" = "Signalstyrke";

/* The title of the section for orangelink commands
- The title of the section for rileylink commands */
+The title of the section for rileylink commands */
"Test Commands" = "Testkommandoer";

/* The title of the cell showing Test Vibration */
```

I see no point in committing this kind of a change. There are other substantive changes in other projects, but there is so much noise from the white space changes, I would like to modify this so only translation updates are included.

##### Question 3:

Both OmniBLE and OmniKit seem to be adding new xx.lproj folders at the top level with the languages already being present in other folders. These have associated changes to the `pbxproj` file. I'm confused by this and wonder if this is something else that should be fixed.

### Export from LoopWorkspace

This section is used to update the strings in lokalise for translation.

First navigate to the LoopWorkspace directory in the appropriate branch. Make sure it is fully up to date with GitHub. Make sure the scripts are executable. You may need to apply `chmod +x` to the scripts.

Make sure the Xcode workspace is **not** open on your Mac or this will fail.

```
./Scripts/manual_export_localizations.sh
```

This creates an xliff_out folder filled with xliff files, one for each language, that contains all the keys and strings for the entire clone (including all submodules).


### Import into lokalise

This section requires the user have `manager` access to the Loop project.

Log into the [lokalise portal](https://app.lokalise.com/projects) and navigate to Loop.

Select [Upload](https://app.lokalise.com/upload/414338966417c70d7055e2.75119857/)

Drag the *.xliff files into the drag and drop location.

Be patient

* while each language is uploaded, the `uploading` indicator shows up under each language on the left side
* at the bottom of the list, the `Import Files` should be available when all have completed uploading
* Tap on `Import Files`
* progress will show at upper right

When this is done, check the Loop lokalise dashboard again to see updated statistics.


### Translations

The translations are performed by volunteers. To volunteer, join [Loop zulipchat]() and send a direct message to Marion Barker with your email address and the language(s) you can translate.

### Export from lokalise

This section requires the user have `manager` access to the Loop project.

Log into the [lokalise portal](https://app.lokalise.com/projects) and navigate to Loop.

Select [Download](https://app.lokalise.com/download/414338966417c70d7055e2.75119857/)

* The default settings were adjusted to match those of the original script (import_localizations.sh)
* Click on the `Build and download` button at either the bottom of the screen or the top left


### Import into LoopWorkspace

When the download from lokalise completes, navigate to your ~/Download folder in finder:

* rename `Loop-Localizable.zip` to `xliff_in.zip`
* uncompress to create the xliff_in folder
* move the xliff_in folder to the top level of the LoopWorkspace folder

The default branch name used for all the submodules is `translations`. If you want to modify that, edit the script and change `translation_dir` before executing the script.

Confirm the list of `projects` in the script is up to date regarding owner, repository name, repository branch.

Execute this script:

```
./Scripts/manual_import_localizations.sh
```

### Commit Changes and Create PRs

Examine the diffs for each submodule to make sure they are appropriate.

There are some changes that are primarily white space, so I did not commit those.

See section on [Open questions](#open-questions).

Status on 2025-07-28:

* Previously LibreTransmitter translations were updated manually and that PR committed
* A hotfix is needed for LibreTransmitter to support European Libre 2 transmitters and it is ready to go
* A PR is merged to G7SensorKit that can be added along with the hotfix

Decided:

* Hotfix will include these prototype scripts and the modification listed above.
* Work will continue on the methodology to capture translations and bring them into Loop in the near future
* This instruction file will be updated as the learning process continues

### Utility Scripts

If you need to start over but don't want to lose prior work, edit this script for name of the branch to archive the translations and execute it.

* archive_translations.sh
* internal names that can be edited:
* archive_dir="test_translations"
* translation_dir="translations"




37 changes: 37 additions & 0 deletions Scripts/archive_translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/zsh

# archive previously created translation branches as test_translations as a "reset" action

set -e
set -u

date=`date`

archive_dir="test_translations"
translation_dir="translations"

projects=(LoopKit:AmplitudeService:dev LoopKit:CGMBLEKit:dev LoopKit:G7SensorKit:main LoopKit:LogglyService:dev LoopKit:Loop:dev LoopKit:LoopKit:dev LoopKit:LoopOnboarding:dev LoopKit:LoopSupport:dev LoopKit:NightscoutRemoteCGM:dev LoopKit:NightscoutService:dev LoopKit:OmniBLE:dev LoopKit:TidepoolService:dev LoopKit:dexcom-share-client-swift:dev LoopKit:RileyLinkKit:dev LoopKit:OmniKit:main LoopKit:MinimedKit:main LoopKit:LibreTransmitter:main)

for project in ${projects}; do
echo "Archive ${translation_dir} branch for $project"
IFS=":" read user dir branch <<< "$project"
echo "parts = $user $dir $branch"
cd $dir
if git switch ${translation_dir}; then
echo "in $dir, configure $archive_dir"
git branch -D ${archive_dir} || true
git switch -c ${archive_dir}
git add .
if git commit -am "Updated translations from Lokalise on ${date}"; then
echo "updated $dir with new translations in ${archive_dir} branch"
fi
git branch -D ${translation_dir}
fi
cd -
done

git submodule update
git status

echo "You may need to manually clean branches not in the project list"

15 changes: 15 additions & 0 deletions Scripts/manual_export_localizations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/zsh

set -e
set -u

LANGUAGES=(ar cs ru en zh-Hans nl fr de it nb pl es ja pt-BR vi da sv fi ro tr he sk hi)

argstring="${LANGUAGES[@]/#/-exportLanguage }"
IFS=" "; args=( $=argstring )

xcodebuild -scheme LoopWorkspace -exportLocalizations -localizationPath xclocs $args

mkdir -p xliff_out
find xclocs -name '*.xliff' -exec cp {} xliff_out \;

59 changes: 59 additions & 0 deletions Scripts/manual_import_localizations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/zsh

# manually download and put the xliff files in the xliff_in folder
# this script imports the customization into the users local clone of LoopWorkspace

set -e
set -u

date=`date`

translation_dir="translations"

# Fetch translations from Lokalise manually before running this script
# They need to be in the xliff_in folder at the LoopWorkspace level

projects=( \
LoopKit:AmplitudeService:dev \
LoopKit:CGMBLEKit:dev \
LoopKit:dexcom-share-client-swift:dev \
LoopKit:G7SensorKit:main \
LoopKit:LibreTransmitter:main \
LoopKit:LogglyService:dev \
LoopKit:Loop:dev \
LoopKit:LoopKit:dev \
LoopKit:LoopOnboarding:dev \
LoopKit:LoopSupport:dev \
LoopKit:MinimedKit:main \
LoopKit:NightscoutRemoteCGM:dev \
LoopKit:NightscoutService:dev \
LoopKit:OmniBLE:dev \
LoopKit:OmniKit:main \
LoopKit:RileyLinkKit:dev \
LoopKit:TidepoolService:dev \
)

for project in ${projects}; do
echo "Prepping $project"
IFS=":" read user dir branch <<< "$project"
echo "parts = $user $dir $branch"
cd $dir
git checkout $branch
git pull
git branch -D ${translation_dir} || true
git checkout -b ${translation_dir} || true
cd -
done

# Build Loop
set -o pipefail && time xcodebuild -workspace LoopWorkspace.xcworkspace -scheme 'LoopWorkspace' build | xcpretty

# Apply translations
foreach file in xliff_in/*.xliff
echo "**********************************"
echo " importing ${file}"
echo "**********************************"
xcodebuild -workspace LoopWorkspace.xcworkspace -scheme "LoopWorkspace" -importLocalizations -localizationPath $file
end

## examine diffs before using the next script
Loading