Skip to content

Commit 403ef77

Browse files
authored
Merge pull request #303 from LoopKit/hotfix/3.6.4
Hotfix to main to support European L2 and localization Updated G7SensorKit (build support - no code change) Modify the minute at which GitHub build actions are requested (cron job)
2 parents f254a4c + 7d15e1b commit 403ef77

11 files changed

+446
-6
lines changed

.github/workflows/build_loop.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ on:
1010
# affect other OS apps if run simultaneously.
1111
# Each OS needs a time of day distinct from other apps, LoopWorkspace uses 9 every Wed and 7 every 1st of month
1212
schedule:
13-
- cron: "0 9 * * 3" # Checks for updates at 09:00 UTC every Wednesday
14-
- cron: "0 7 1 * *" # Builds the app on the 1st of every month at 07:00 UTC
13+
# avoid starting an action at hh:00 when GitHub resources are impacted
14+
- cron: "33 9 * * 3" # Checks for updates at 09:33 UTC every Wednesday
15+
- cron: "33 7 1 * *" # Builds the app on the 1st of every month at 07:33 UTC
1516

1617
env:
1718
UPSTREAM_REPO: LoopKit/LoopWorkspace
@@ -200,7 +201,7 @@ jobs:
200201
| # 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
201202
github.event_name == 'workflow_dispatch' ||
202203
(needs.check_alive_and_permissions.outputs.WORKFLOW_PERMISSION == 'true' &&
203-
(vars.SCHEDULED_BUILD != 'false' && github.event.schedule == '0 7 1 * *') ||
204+
(vars.SCHEDULED_BUILD != 'false' && github.event.schedule == '33 7 1 * *') ||
204205
(vars.SCHEDULED_SYNC != 'false' && needs.check_latest_from_upstream.outputs.NEW_COMMITS == 'true' )
205206
)
206207
steps:

LoopWorkspace.xcworkspace/contents.xcworkspacedata

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Scripts/LocalizationInstructions.md

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
## Manual Localization Instructions
2+
3+
> This is work-in-progress. There are some open questions on how to deal with certain strings.
4+
5+
There are several scripts to automate the localization process. However, these localization scripts require access to tokens:
6+
7+
* export_localizations.sh
8+
* import_localizations.sh
9+
10+
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.
11+
12+
New scripts were created to provide a step-by-step manual process:
13+
14+
* manual_export_localizations.sh
15+
* manual_import_localizations.sh
16+
* manual_review_translations.sh
17+
* manual_translations_finalize.sh
18+
19+
The summary action for these script is provided here, with details in the [Usage](#usage) section.
20+
21+
#### manual_export_localizations
22+
23+
* script to create xliff_out folder with xliff files in all languages suitable to drag and drop into lokalise
24+
25+
#### manual_import_localizations
26+
27+
* script to import from xliff_in folder
28+
* create `translations` branch for each project
29+
* command-line Xcode build before importing xliff files
30+
* command-line Xcode build for each language importing from the associated xliff file
31+
* after completion, LoopWorkspace has uncommitted changes in projects
32+
33+
#### manual_review_translations
34+
35+
* script to make it easy to review changes per submodule, shows diffs, and pause so manual modifications can be enacted if appropriate
36+
37+
#### manual_translations_finalize
38+
39+
* script to commit the change for each project folder (submodule)
40+
* if there are no changes, no action is taken
41+
* if there are changes
42+
* git add .; commit all with automated message
43+
* push the `translations` branch to origin
44+
* create a PR from `translations` branch to default branch for that repository
45+
* open the URL for the PR
46+
47+
## Usage
48+
49+
### Loop Dashboard at localise
50+
51+
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.
52+
53+
#### Open questions
54+
55+
> Notes from Marion Barker:
56+
57+
##### Question 1:
58+
59+
I do not believe these keys should be included in the translation process:
60+
61+
* CFBundleGetInfoString
62+
* CFBundleNames
63+
* NSHumanReadableCopyright
64+
65+
These were almost all empty. I deleted these keys on 2025-07-27 on the lokalise site.
66+
67+
A few of them did have entries for some languages
68+
69+
* I have them archived locally and can restore them if they should have been kept
70+
71+
When uploading a new set of xliff_out files, they are recreated - so I think I'm missing a method to limit them.
72+
73+
Note that in the xliff files, these say translate="no", so why do they show up in the imported list on lokalise?
74+
75+
I will keep looking for help in the documentation, but if anyone knows - let me know.
76+
77+
Because of this uncertainty, I only modified the LibreTransmitter project so far because there is a hotfix needed for it.
78+
79+
##### Question 2:
80+
81+
A lot of the changes that were proposed were white space changes.
82+
83+
Here's an example:
84+
85+
```
86+
diff --git a/RileyLinkKitUI/nb.lproj/Localizable.strings b/RileyLinkKitUI/nb.lproj/Localizable.strings
87+
index fbfc31e..db53cbd 100644
88+
--- a/RileyLinkKitUI/nb.lproj/Localizable.strings
89+
+++ b/RileyLinkKitUI/nb.lproj/Localizable.strings
90+
@@ -74,7 +74,7 @@
91+
"Name" = "Navn";
92+
93+
/* Detail text when battery alert disabled.
94+
- Text indicating LED Mode is off */
95+
+Text indicating LED Mode is off */
96+
"Off" = "Av";
97+
98+
/* Text indicating LED Mode is on */
99+
@@ -87,7 +87,7 @@
100+
"Signal Strength" = "Signalstyrke";
101+
102+
/* The title of the section for orangelink commands
103+
- The title of the section for rileylink commands */
104+
+The title of the section for rileylink commands */
105+
"Test Commands" = "Testkommandoer";
106+
107+
/* The title of the cell showing Test Vibration */
108+
```
109+
110+
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.
111+
112+
##### Question 3:
113+
114+
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.
115+
116+
### Export from LoopWorkspace
117+
118+
This section is used to update the strings in lokalise for translation.
119+
120+
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.
121+
122+
Make sure the Xcode workspace is **not** open on your Mac or this will fail.
123+
124+
```
125+
./Scripts/manual_export_localizations.sh
126+
```
127+
128+
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).
129+
130+
131+
### Import into lokalise
132+
133+
This section requires the user have `manager` access to the Loop project.
134+
135+
Log into the [lokalise portal](https://app.lokalise.com/projects) and navigate to Loop.
136+
137+
Select [Upload](https://app.lokalise.com/upload/414338966417c70d7055e2.75119857/)
138+
139+
Drag the *.xliff files into the drag and drop location.
140+
141+
Be patient
142+
143+
* while each language is uploaded, the `uploading` indicator shows up under each language on the left side
144+
* at the bottom of the list, the `Import Files` should be available when all have completed uploading
145+
* Tap on `Import Files`
146+
* progress will show at upper right
147+
148+
When this is done, check the Loop lokalise dashboard again to see updated statistics.
149+
150+
151+
### Translations
152+
153+
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.
154+
155+
### Export from lokalise
156+
157+
This section requires the user have `manager` access to the Loop project.
158+
159+
Log into the [lokalise portal](https://app.lokalise.com/projects) and navigate to Loop.
160+
161+
Select [Download](https://app.lokalise.com/download/414338966417c70d7055e2.75119857/)
162+
163+
* The default settings were adjusted to match those of the original script (import_localizations.sh)
164+
* Click on the `Build and download` button at either the bottom of the screen or the top left
165+
166+
167+
### Import into LoopWorkspace
168+
169+
When the download from lokalise completes, navigate to your ~/Download folder in finder:
170+
171+
* rename `Loop-Localizable.zip` to `xliff_in.zip`
172+
* uncompress to create the xliff_in folder
173+
* move the xliff_in folder to the top level of the LoopWorkspace folder
174+
175+
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.
176+
177+
Confirm the list of `projects` in the script is up to date regarding owner, repository name, repository branch.
178+
179+
Execute this script:
180+
181+
```
182+
./Scripts/manual_import_localizations.sh
183+
```
184+
185+
### Commit Changes and Create PRs
186+
187+
Examine the diffs for each submodule to make sure they are appropriate.
188+
189+
There are some changes that are primarily white space, so I did not commit those.
190+
191+
See section on [Open questions](#open-questions).
192+
193+
Status on 2025-07-28:
194+
195+
* Previously LibreTransmitter translations were updated manually and that PR committed
196+
* A hotfix is needed for LibreTransmitter to support European Libre 2 transmitters and it is ready to go
197+
* A PR is merged to G7SensorKit that can be added along with the hotfix
198+
199+
Decided:
200+
201+
* Hotfix will include these prototype scripts and the modification listed above.
202+
* Work will continue on the methodology to capture translations and bring them into Loop in the near future
203+
* This instruction file will be updated as the learning process continues
204+
205+
### Utility Scripts
206+
207+
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.
208+
209+
* archive_translations.sh
210+
* internal names that can be edited:
211+
* archive_dir="test_translations"
212+
* translation_dir="translations"
213+
214+
215+
216+

Scripts/archive_translations.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/zsh
2+
3+
# archive previously created translation branches as test_translations as a "reset" action
4+
5+
set -e
6+
set -u
7+
8+
date=`date`
9+
10+
archive_dir="test_translations"
11+
translation_dir="translations"
12+
13+
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)
14+
15+
for project in ${projects}; do
16+
echo "Archive ${translation_dir} branch for $project"
17+
IFS=":" read user dir branch <<< "$project"
18+
echo "parts = $user $dir $branch"
19+
cd $dir
20+
if git switch ${translation_dir}; then
21+
echo "in $dir, configure $archive_dir"
22+
git branch -D ${archive_dir} || true
23+
git switch -c ${archive_dir}
24+
git add .
25+
if git commit -am "Updated translations from Lokalise on ${date}"; then
26+
echo "updated $dir with new translations in ${archive_dir} branch"
27+
fi
28+
git branch -D ${translation_dir}
29+
fi
30+
cd -
31+
done
32+
33+
git submodule update
34+
git status
35+
36+
echo "You may need to manually clean branches not in the project list"
37+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/zsh
2+
3+
set -e
4+
set -u
5+
6+
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)
7+
8+
argstring="${LANGUAGES[@]/#/-exportLanguage }"
9+
IFS=" "; args=( $=argstring )
10+
11+
xcodebuild -scheme LoopWorkspace -exportLocalizations -localizationPath xclocs $args
12+
13+
mkdir -p xliff_out
14+
find xclocs -name '*.xliff' -exec cp {} xliff_out \;
15+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/zsh
2+
3+
# manually download and put the xliff files in the xliff_in folder
4+
# this script imports the customization into the users local clone of LoopWorkspace
5+
6+
set -e
7+
set -u
8+
9+
date=`date`
10+
11+
translation_dir="translations"
12+
13+
# Fetch translations from Lokalise manually before running this script
14+
# They need to be in the xliff_in folder at the LoopWorkspace level
15+
16+
projects=( \
17+
LoopKit:AmplitudeService:dev \
18+
LoopKit:CGMBLEKit:dev \
19+
LoopKit:dexcom-share-client-swift:dev \
20+
LoopKit:G7SensorKit:main \
21+
LoopKit:LibreTransmitter:main \
22+
LoopKit:LogglyService:dev \
23+
LoopKit:Loop:dev \
24+
LoopKit:LoopKit:dev \
25+
LoopKit:LoopOnboarding:dev \
26+
LoopKit:LoopSupport:dev \
27+
LoopKit:MinimedKit:main \
28+
LoopKit:NightscoutRemoteCGM:dev \
29+
LoopKit:NightscoutService:dev \
30+
LoopKit:OmniBLE:dev \
31+
LoopKit:OmniKit:main \
32+
LoopKit:RileyLinkKit:dev \
33+
LoopKit:TidepoolService:dev \
34+
)
35+
36+
for project in ${projects}; do
37+
echo "Prepping $project"
38+
IFS=":" read user dir branch <<< "$project"
39+
echo "parts = $user $dir $branch"
40+
cd $dir
41+
git checkout $branch
42+
git pull
43+
git branch -D ${translation_dir} || true
44+
git checkout -b ${translation_dir} || true
45+
cd -
46+
done
47+
48+
# Build Loop
49+
set -o pipefail && time xcodebuild -workspace LoopWorkspace.xcworkspace -scheme 'LoopWorkspace' build | xcpretty
50+
51+
# Apply translations
52+
foreach file in xliff_in/*.xliff
53+
echo "**********************************"
54+
echo " importing ${file}"
55+
echo "**********************************"
56+
xcodebuild -workspace LoopWorkspace.xcworkspace -scheme "LoopWorkspace" -importLocalizations -localizationPath $file
57+
end
58+
59+
## examine diffs before using the next script

0 commit comments

Comments
 (0)