Skip to content

Commit

Permalink
Merge branch 'master' into bump-ruby-stage
Browse files Browse the repository at this point in the history
  • Loading branch information
plowsof authored Jul 9, 2024
2 parents f3f316c + 37170b4 commit 1703c05
Show file tree
Hide file tree
Showing 154 changed files with 4,028 additions and 3,257 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
- name: install bundler
run: gem install bundler:2.2.23
run: gem install bundler:2.5.14
- name: bundle install
run: bundle install --jobs 4 --retry 3
- name: build site
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/hashes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ jobs:
filename="${the_line[$length]}"
echo "${filename}"
}
# expects cli files between lines 2-13 and gui 14-18 (comments do not count, 1st line = 0)
# to add a new file to the cli, $num must be -gt 1 and -lt 15.
# gui $num is now -gt 14 and -lt 20 (new line has been added above)
# expects cli files between lines 2-14 and gui 15-19 (comments do not count, 1st line = 0)
# to add a new file to the cli, $num must be -gt 1 and -lt 16.
# gui $num is now -gt 15 and -lt 21 (new line has been added above)
# a new gui file will only increase the -lt number by 1
# changes to extensions / new files must be reflected in the cli_files / gui_files lists below
num=0
for line in "${lines[@]}"; do
if [ $num -gt 1 ] && [ $num -lt 14 ] ; then
if [ $num -gt 1 ] && [ $num -lt 15 ] ; then
#CLI
filename=$(get_filename "${line}")
filenames_cli+=("${filename}")
elif [ $num -gt 13 ] && [ $num -lt 20 ] ; then
elif [ $num -gt 14 ] && [ $num -lt 21 ] ; then
#GUI
filename=$(get_filename "${line}")
filenames_gui+=("${filename}")
Expand All @@ -71,6 +71,7 @@ jobs:
"monero-freebsd-x64-${version_cli}.tar.bz2" \
"monero-linux-armv7-${version_cli}.tar.bz2" \
"monero-linux-armv8-${version_cli}.tar.bz2" \
"monero-linux-riscv64-${version_cli}.tar.bz2" \
"monero-linux-x64-${version_cli}.tar.bz2" \
"monero-linux-x86-${version_cli}.tar.bz2" \
"monero-mac-armv8-${version_cli}.tar.bz2" \
Expand Down Expand Up @@ -140,6 +141,7 @@ jobs:
*cli/linux32) filename=monero-linux-x86 ;;
*cli/linuxarm8) filename=monero-linux-armv8 ;;
*cli/linuxarm7) filename=monero-linux-armv7 ;;
*cli/linuxriscv64) filename=monero-linux-riscv64 ;;
*cli/androidarm8) filename=monero-android-armv8 ;;
*cli/androidarm7) filename=monero-android-armv7 ;;
*cli/freebsd64) filename=monero-freebsd-x64 ;;
Expand Down
184 changes: 184 additions & 0 deletions .github/workflows/po4a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
name: run-po4a

on:
push:
paths:
- '**.po'
- '**.pot'
- '**.md' #temp for all md files.
branches: po4a-staged
workflow_dispatch:
inputs:
run_on_all:
description: 'Run po4a on all files'
required: false
default: 'false'

jobs:
changed_files:
runs-on: ubuntu-latest # windows-latest || macos-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write
pull-requests: write
name: Test changed-files
steps:
- name: Clone po4a repository at specific commit
run: |
git clone https://github.com/mquinson/po4a.git
cd po4a
git checkout v0.69
- name: Install Debian dependencies
run: |
sudo apt update
sudo apt install -y liblocale-gettext-perl libtext-wrapi18n-perl libunicode-linebreak-perl libpod-parser-perl libtest-pod-perl libyaml-tiny-perl libsyntax-keyword-try-perl
sudo apt install -y cpanminus gettext docbook-xml docbook-xsl docbook xsltproc
sudo apt install -y texlive-binaries texlive-latex-base opensp libsgmls-perl
- name: Install CPAN dependencies
run: |
cpanm Locale::gettext
cpanm http://search.cpan.org/CPAN/authors/id/R/RA/RAAB/SGMLSpm-1.1.tar.gz
cpanm Text::WrapI18N
cpanm Unicode::GCString
cd po4a
cpanm -v --installdeps --notest .
- name: Build
run: |
cd po4a
perl Build.PL
COLUMNS=120 ./Build verbose=1
- name: Install po4a
run: |
cd po4a
sudo ./Build install
cd ..
rm -rf po4a
- uses: actions/checkout@v4
with:
ref: ${{ github.head }}
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
# NOTE: `since_last_remote_commit: true` is implied by default and falls back to the previous local commit.
- name: Run step if po/pot files are changed
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
RUN_ON_ALL: ${{ github.event.inputs.run_on_all }}
run: |
RUN_ON_ALL=${RUN_ON_ALL:="false"}
ALL_CHANGED_FILES_ARRAY=()
CHANGED_MD_FILES_ARRAY=()
# Check if RUN_ON_ALL is set to 'true'
if [ "$RUN_ON_ALL" == "true" ]; then
echo "list of all .md files in user-guides and moneropedia..."
# Add all user-guides and moneropedia .md files
for guide in _i18n/en/resources/user-guides/*.md; do
echo "-> Adding ${guide} to file list"
ALL_CHANGED_FILES_ARRAY+=("${guide}")
done
for entry in _i18n/en/resources/moneropedia/*.md; do
echo "-> Adding ${entry} to file list"
ALL_CHANGED_FILES_ARRAY+=("${entry}")
done
else
echo "Running po4a on modified po/pot files only..."
# Split ALL_CHANGED_FILES into an array
IFS=' ' read -r -a ALL_CHANGED_FILES_ARRAY <<< "$ALL_CHANGED_FILES"
for file in "${ALL_CHANGED_FILES_ARRAY[@]}"; do
if [[ "$file" == *.po || "$file" == *.pot ]]; then
directory=$(echo "$file" | sed -E 's|_i18n/[^/]+/resources/([^/]+)/.*|\1|')
base_filename=$(basename "$file" | sed -E 's/\.(po|pot)$//')
md_file="_i18n/en/resources/${directory}/${base_filename}.md"
if [ -f "$md_file" ]; then
echo "-> Adding ${md_file} to file list"
CHANGED_MD_FILES_ARRAY+=("${md_file}")
fi
else
CHANGED_MD_FILES_ARRAY+=("${file}")
fi
#remove duplicates
ALL_CHANGED_FILES_ARRAY=($(printf "%s\n" "${CHANGED_MD_FILES_ARRAY[@]}" | sort -u))
done
fi
for file in ${ALL_CHANGED_FILES_ARRAY}; do
echo "$file was changed"
done
git config --global user.name "weblate-po4a"
git config --global user.email "[email protected]"
ERROR=0
for md_file in "${ALL_CHANGED_FILES_ARRAY[@]}"; do
cd po
# Determine the base directory and base filename
directory=$(echo "$md_file" | sed -E 's|_i18n/[^/]+/resources/([^/]+)/.*|\1|')
base_filename=$(basename "$md_file" | sed -E 's/\.md$//')
# Construct the po4a configuration dynamically
po4a_config="[po4a_langs] es it pl fr ar ru de nl pt-br tr zh-cn zh-tw nb-no\n"
po4a_config+="[po4a_paths] ../_i18n/en/resources/${directory}/weblate/${base_filename}.pot \$lang:../_i18n/\$lang/resources/${directory}/weblate/${base_filename}.po\n"
po4a_config+="[options] opt:\"--keep=0\"\n"
po4a_config+="[options] opt:\"--localized-charset=UTF-8\"\n"
po4a_config+="[options] opt:\"--master-charset=UTF-8\"\n"
po4a_config+="[options] opt:\"--master-language=en_US\"\n"
po4a_config+="[options] opt:\"--msgmerge-opt='--no-wrap'\"\n"
po4a_config+="[options] opt:\"--wrap-po=newlines\"\n"
po4a_config+="[po4a_alias:markdown] text opt:\"--option markdown\"\n"
po4a_config+="[type: markdown] ../_i18n/en/resources/${directory}/${base_filename}.md \$lang:../_i18n/\$lang/resources/${directory}/${base_filename}.md\n"
echo -e "${po4a_config}" > po4a-config.txt
cat po4a-config.txt
if po4a po4a-config.txt; then
echo "po4a ran successfully on ${md_file}"
else
echo "::warning file=${md_file}::po4a didn't run successfully"
ERROR=1
fi
rm po4a-config.txt
cd ..
git add .
COMMIT_MESSAGE="po4a: ${directory}/${base_filename} updates"
git commit -m "${COMMIT_MESSAGE}" || echo "No changes to commit for ${directory}/${base_filename}"
done
#- name: Check if PR exists
# id: check
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# prs=$(gh pr list \
# --repo "$GITHUB_REPOSITORY" \
# --head 'po4a-staged' \
# --base 'master' \
# --json title \
# --jq 'length')
# if ((prs > 0)); then
# echo "skip=true" >> "$GITHUB_OUTPUT"
# fi

- name: push to po4a-staged
#if: 'steps.check.outputs.skip'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: po4a-staged
#force: true

#- name: Create pull request
# if: '!steps.check.outputs.skip'
# uses: peter-evans/create-pull-request@v6
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# branch: po4a-staged
# continue-on-error: true
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ A few random points of note:

### Tor

This website is available natively on Tor. The onion address is in `_includes/onion.html` and a signed document containing the same address is in `/onion.txt`. The address in these 2 files must *always* match. The `onion.txt` files also includes the onion address of the 'downloads' subdomain.
This website is available natively on Tor. The onion address is in `_includes/onion.html` and a signed document containing the same address is in `/onion.txt`. The address in these 2 files must *always* match. The `onion.txt` file also includes the onion address of the 'downloads' subdomain.

If you want to post getmonero's onion address somewhere on the website, don't simply write it, instead include it using `{% include onion.html %}`. This avoids problems with typos and allow us top change the address only in one file if necessary.
If you want to post getmonero's onion address somewhere on the website, don't simply write it, instead include it using `{% include onion.html %}`. This avoids problems with typos and allows us to change the address only in one file if necessary.

## PR workflow

To simplify the process of drafting, reviewing and merging pull requests, we use a GitHub Project board. This Kanban board makes easier for people to see and participate to the pull request workflow: [monero-site: PR workflow](https://github.com/orgs/monero-project/projects/1).

## Translation

In this section you'll find the info you need to translate a page and add a new translation, but keep in mind that Monero has a [Localization Workgroup](https://github.com/monero-ecosystem/monero-translations) who coordinate and give support to translators-volunteers. For live support/request of information, come chat on `#monero-translations` on Matrix or IRC (Libera.chat)
The entire website is translatable on Weblate, an easy to use localization platform that provide contributors with a user friendly interface: [translate.getmonero.org](https://translate.getmonero.org). Before translating, please read [the guide for translators](https://github.com/monero-ecosystem/monero-translations/blob/master/weblate.md), which contains all the info and workflows you need to know before starting.
In this section you'll find the info you need to translate a page and add a new translation, but keep in mind that Monero has a [Localization Workgroup](https://github.com/monero-ecosystem/monero-translations) who coordinates and gives support to translators-volunteers. For live support/request of information, come chat on `#monero-translations` on Matrix or IRC (Libera.chat)
The entire website is translatable on Weblate, an easy to use localization platform that provides contributors with a user friendly interface: [translate.getmonero.org](https://translate.getmonero.org). Before translating, please read [the guide for translators](https://github.com/monero-ecosystem/monero-translations/blob/master/weblate.md), which contains all the info and workflows you need to know before starting.

Translators are required to have:

Expand Down Expand Up @@ -247,7 +247,7 @@ Where `ENTRY` is a one word identifier for the title/name of your Moneropedia en

### 2. Make the localized File

Navigate to the `/_i18n/en/resources/moneropedia` folder and make a new file. give it the same <name>.md than in previous step.
Navigate to the `/_i18n/en/resources/moneropedia` folder and make a new file. Give it the same <name>.md as in the previous step.
Start the file with the front Matter:

```
Expand All @@ -272,7 +272,7 @@ Now you need to add the title of the page to the `_18n/en.yml` file. It *must* b

## How to update the Workgroups page

The page is composed by boxes, each containing a workgroup. Just make sure to copy the structure from the preceding box and paste it right after it.
The page is composed of boxes, each containing a workgroup. Just make sure to copy the structure from the preceding box and paste it right after it.

Note that the class of the `div` which forms the box is `right/left half col-lg-6 col-md-6 col-sm-12 col-xs-12`. Make sure to choose `left` or `right` according to the position you want the box to appear in.

Expand Down
Loading

0 comments on commit 1703c05

Please sign in to comment.