Skip to content
Open
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
1 change: 1 addition & 0 deletions .tx/backport
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stable21.1
58 changes: 54 additions & 4 deletions generate-localizable-strings-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,59 @@
# generate-localizable-strings-file.sh

echo 'Generating Localizable.strings file...'
cd NextcloudTalk
genstrings -o en.lproj -SwiftUI *.m *.swift ../ShareExtension/*.m ../ShareExtension/*.swift ../NotificationServiceExtension/*.m ../BroadcastUploadExtension/*.swift ../TalkIntents/*.swift ../ThirdParty/SlackTextViewController/Source/*.m
iconv -f UTF-16 -t UTF-8 en.lproj/Localizable.strings > en.lproj/Localizable-utf8.strings
mv en.lproj/Localizable-utf8.strings en.lproj/Localizable.strings

STABLE_BRANCH=$(<.tx/backport)

FILE_PATHS=(
"NextcloudTalk/*.m"
"NextcloudTalk/*.swift"
"ShareExtension/*.m"
"ShareExtension/*.swift"
"NotificationServiceExtension/*.m"
"BroadcastUploadExtension/*.swift"
"TalkIntents/*.swift"
"ThirdParty/SlackTextViewController/Source/*.m"
)

STABLE_BRANCH_FILE_PATHS=(
"NextcloudTalk/*.m"
"NextcloudTalk/*.swift"
"ShareExtension/*.m"
"ShareExtension/*.swift"
"NotificationServiceExtension/*.m"
"BroadcastUploadExtension/*.swift"
"TalkIntents/*.swift"
"ThirdParty/SlackTextViewController/Source/*.m"
)

CURRENT_BRANCH=$(git branch --show-current)

if [ "$CURRENT_BRANCH" != $STABLE_BRANCH ]; then
echo "Not on $STABLE_BRANCH branch, cloning $STABLE_BRANCH branch"

REMOTE_URL=$(git config --get remote.origin.url)
if [ -z "$REMOTE_URL" ]; then
echo "No remote URL found. Please check your git config."
exit 1
fi

git clone --branch $STABLE_BRANCH --single-branch --depth 1 $REMOTE_URL $STABLE_BRANCH
cd $STABLE_BRANCH
git submodule update --init
cd ..

STABLE_FILE_PATHS=()
for path in "${STABLE_BRANCH_FILE_PATHS[@]}"; do
STABLE_FILE_PATHS+=("$STABLE_BRANCH/$path")
done

else
echo "On $STABLE_BRANCH branch"
fi

genstrings -o NextcloudTalk/en.lproj -SwiftUI ${FILE_PATHS[@]} ${STABLE_FILE_PATHS[@]}
iconv -f UTF-16 -t UTF-8 NextcloudTalk/en.lproj/Localizable.strings > NextcloudTalk/en.lproj/Localizable-utf8.strings
mv NextcloudTalk/en.lproj/Localizable-utf8.strings NextcloudTalk/en.lproj/Localizable.strings
rm -rf "$STABLE_BRANCH"
echo 'Localizable.strings file generated!'

Loading