Add script to import strings, and doc.
Add GitHub action to sync strings.
This commit is contained in:
parent
8c93aedbc1
commit
2c1a2dc444
3 changed files with 97 additions and 0 deletions
25
.github/workflows/sync-from-external-sources.yml
vendored
Normal file
25
.github/workflows/sync-from-external-sources.yml
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
name: Sync Data From External Sources
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# Every nights at 6
|
||||||
|
- cron: "0 6 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-strings:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# Skip in forks
|
||||||
|
if: github.repository == 'vector-im/element-x-android'
|
||||||
|
# No concurrency required, runs every time on a schedule.
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Run local script
|
||||||
|
run: ./tools/strings/importStringsFromElement.sh
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v4
|
||||||
|
with:
|
||||||
|
commit-message: Import strings from Element Android
|
||||||
|
title: Sync strings
|
||||||
|
body: |
|
||||||
|
- Update strings from Element Android
|
||||||
|
branch: sync-strings
|
||||||
|
base: develop
|
||||||
15
libraries/ui-strings/README.md
Normal file
15
libraries/ui-strings/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
## Module ui-strings
|
||||||
|
|
||||||
|
This module contains strings from Element Android.
|
||||||
|
|
||||||
|
The content of this module will be keep synced by the script `rootDir/tools/strings/importStringsFromElement.sh`, which is run daily by a GitHub action.
|
||||||
|
|
||||||
|
### Adding new strings
|
||||||
|
|
||||||
|
Add new strings to the file `./src/main/res/values/new_strings.xml`, or your new strings will be erased on the next sync.
|
||||||
|
|
||||||
|
Also, new strings must be added to Element Android to give a chance to get translation.
|
||||||
|
|
||||||
|
### Long term
|
||||||
|
|
||||||
|
In the future, Weblate will be synced directly with this project.
|
||||||
57
tools/strings/importStringsFromElement.sh
Executable file
57
tools/strings/importStringsFromElement.sh
Executable file
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2023 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
printf "================================================================================\n"
|
||||||
|
printf "| Importing strings from Element |\n"
|
||||||
|
printf "================================================================================\n"
|
||||||
|
|
||||||
|
basedir=`pwd`
|
||||||
|
tmpPath="${basedir}/tmpStrings"
|
||||||
|
|
||||||
|
## Delete tmp dir
|
||||||
|
#rm -rf ${tmpPath}
|
||||||
|
|
||||||
|
# Create tmp dir
|
||||||
|
mkdir ${tmpPath}
|
||||||
|
|
||||||
|
printf "\n================================================================================\n"
|
||||||
|
printf "Downloading Element Android source from develop...\n"
|
||||||
|
|
||||||
|
curl https://github.com/vector-im/element-android/archive/refs/heads/develop.zip -i -L -o ${tmpPath}/element.zip
|
||||||
|
|
||||||
|
printf "\n================================================================================\n"
|
||||||
|
printf "Unzipping Element Android source...\n"
|
||||||
|
|
||||||
|
unzip -q ${tmpPath}/element.zip -d ${tmpPath}
|
||||||
|
|
||||||
|
printf "\n================================================================================\n"
|
||||||
|
printf "Importing the strings...\n"
|
||||||
|
elementAndroidPath="${tmpPath}/element-android-develop"
|
||||||
|
|
||||||
|
cp -R ${elementAndroidPath}/library/ui-strings/src/main/res ${basedir}/libraries/ui-strings/src/main
|
||||||
|
|
||||||
|
## Delete tmp dir
|
||||||
|
rm -rf ${tmpPath}
|
||||||
|
|
||||||
|
# Commit all changes to git
|
||||||
|
# git commit -a -m "Import strings from Element Android"
|
||||||
|
|
||||||
|
printf "\n================================================================================\n"
|
||||||
|
printf "Done\n"
|
||||||
|
printf "================================================================================\n"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue