Adding finish language and build script

This commit is contained in:
Ric Harvey 2024-06-17 20:48:18 +01:00
parent 21f72a79c5
commit ffce4cf469
Signed by: ric
GPG key ID: CD63CE502B962F16
3 changed files with 94 additions and 0 deletions

59
build.sh Executable file
View file

@ -0,0 +1,59 @@
#!/bin/bash
# update submodule to latest release
git submodule update --init --recursive
# get latest mastodon release number (needed to tag docker image)
mastodon_version=`curl -sL https://api.github.com/repos/mastodon/mastodon/releases/latest | jq -r ".tag_name"`
# Change to the main repo
cd mastodon
export MASTODON_VERSION_FOR_BIRD_UI="main"
# Create a new folder for the theme
mkdir -p app/javascript/styles/mastodon-bird-ui
# Download the CSS file for single column layout
wget -N --no-check-certificate --no-cache --no-cookies --no-http-keep-alive https://raw.githubusercontent.com/ronilaukkarinen/mastodon-bird-ui/$MASTODON_VERSION_FOR_BIRD_UI/layout-single-column.css -O app/javascript/styles/mastodon-bird-ui/layout-single-column.scss
# Download the CSS file for multiple column layout
wget -N --no-check-certificate --no-cache --no-cookies --no-http-keep-alive https://raw.githubusercontent.com/ronilaukkarinen/mastodon-bird-ui/$MASTODON_VERSION_FOR_BIRD_UI/layout-multiple-columns.css -O app/javascript/styles/mastodon-bird-ui/layout-multiple-columns.scss
# Replace theme-contrast with theme-mastodon-bird-ui-contrast for single column layout
sed -i 's/theme-contrast/theme-mastodon-bird-ui-contrast/g' app/javascript/styles/mastodon-bird-ui/layout-single-column.scss
# Replace theme-mastodon-light with theme-mastodon-bird-ui-light for single column layout
sed -i 's/theme-mastodon-light/theme-mastodon-bird-ui-light/g' app/javascript/styles/mastodon-bird-ui/layout-single-column.scss
# Replace theme-contrast with theme-mastodon-bird-ui-contrast for multiple column layout
sed -i 's/theme-contrast/theme-mastodon-bird-ui-contrast/g' app/javascript/styles/mastodon-bird-ui/layout-multiple-columns.scss
# Replace theme-mastodon-light with theme-mastodon-bird-ui-light for multiple column layout
sed -i 's/theme-mastodon-light/theme-mastodon-bird-ui-light/g' app/javascript/styles/mastodon-bird-ui/layout-multiple-columns.scss
# Create high contrast theme file
echo -e "@import 'contrast/variables';\n@import 'application';\n@import 'contrast/diff';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" > app/javascript/styles/mastodon-bird-ui-contrast.scss
# Create light theme file
echo -e "@import 'mastodon-light/variables';\n@import 'application';\n@import 'mastodon-light/diff';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" > app/javascript/styles/mastodon-bird-ui-light.scss
# Create dark theme file
echo -e "@import 'application';\n@import 'mastodon-bird-ui/layout-single-column.scss';\n@import 'mastodon-bird-ui/layout-multiple-columns.scss';" > app/javascript/styles/mastodon-bird-ui-dark.scss
# Overwrite config/themes.yml with new settings, Mastodon Bird UI dark as default
echo -e "default: styles/mastodon-bird-ui-dark.scss\nmastodon-bird-ui-light: styles/mastodon-bird-ui-light.scss\nmastodon-bird-ui-contrast: styles/mastodon-bird-ui-contrast.scss\nmastodon-dark: styles/application.scss\nmastodon-light: styles/mastodon-light.scss\ncontrast: styles/contrast.scss" > config/themes.yml
# Patch the locales this will loop thtough more as we add them
for i in `ls ../patches/` ; do patch -N config/locales/"${i/diff/yml}" < ../patches/$i ; done
# Build the images for multiple architectures
docker buildx build --platform linux/amd64,linux/arm64 --push -t richarvey/mastodon-bird-ui:$mastodon_version .
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$BRANCH" == "main" ]]; then
echo 'main branch';
# Build the images for multiple architectures
docker buildx build --platform linux/amd64,linux/arm64 --push --tag richarvey/mastodon-bird-ui:$mastodon_version --tag richarvey/mastodon-bird-ui .
fi

19
patches/en.diff Normal file
View file

@ -0,0 +1,19 @@
--- mastodon/config/locales/en.yml 2024-06-17 17:21:11.527756697 +0000
+++ en.yml 2024-06-17 17:24:46.506720584 +0000
@@ -1736,9 +1736,13 @@
tags:
does_not_match_previous_name: does not match the previous name
themes:
- contrast: Mastodon (High contrast)
- default: Mastodon (Dark)
- mastodon-light: Mastodon (Light)
+ contrast: Mastodon (High contrast)
+ default: Mastodon Bird UI (Dark)
+ mastodon-bird-ui-dark: Mastodon Bird UI (Dark)
+ mastodon-bird-ui-light: Mastodon Bird UI (Light)
+ mastodon-bird-ui-contrast: Mastodon Bird UI (High contrast)
+ mastodon-light: Mastodon (Light)
+ mastodon-dark: Mastodon (Dark)
time:
formats:
default: "%b %d, %Y, %H:%M"

16
patches/fi.diff Normal file
View file

@ -0,0 +1,16 @@
--- mastodon/config/locales/fi.yml 2024-06-17 18:16:43.497414066 +0100
+++ fi.yml 2024-06-17 20:45:58.558026465 +0100
@@ -1731,8 +1731,12 @@
does_not_match_previous_name: ei vastaa edellistä nimeä
themes:
contrast: Mastodon (Korkea kontrasti)
- default: Mastodon (Tumma)
+ default: Mastodon Bird UI (Tumma)
+ mastodon-bird-ui-dark: Mastodon Vird UI (Tumma)
+ mastodon-bird-ui-light: Mastodon Bird UI (Vaalea)
+ mastodon-bird-ui-contrast: Mastodon Bird UI (Korkea kontrasti)
mastodon-light: Mastodon (Vaalea)
+ mastodon-dark: Mastodon (Tumma)
time:
formats:
default: "%d.%m.%Y klo %H.%M"