From 4c8d58b646ac62e67fc34c12f8cad51e7512bee3 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Fri, 5 Apr 2024 15:00:27 -0400 Subject: add en_CAT makefile and use ucfirst/ucwords --- src/web/lang/Makefile | 19 +++++++++++++++++++ src/web/lang/_bin/transpile.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/web/lang/Makefile create mode 100755 src/web/lang/_bin/transpile.sh (limited to 'src/web/lang') diff --git a/src/web/lang/Makefile b/src/web/lang/Makefile new file mode 100644 index 0000000..fd4ca9c --- /dev/null +++ b/src/web/lang/Makefile @@ -0,0 +1,19 @@ +# +# en_CAT generator from en_US +# uwuify and awk required +# + +LANG_SRC = $(shell find en_US -type f) +LANG_OBJ = $(patsubst en_US/%,en_CAT/%,$(LANG_SRC)) + +.PHONY: all + +all: $(LANG_OBJ) + +$(LANG_OBJ): en_CAT/% : en_US/% + @printf "\033[35m UWU \033[0m%s\n" $< + @mkdir -p $(@D) + @./_bin/transpile.sh $< $@ + +clean: + @rm -fr "en_CAT" diff --git a/src/web/lang/_bin/transpile.sh b/src/web/lang/_bin/transpile.sh new file mode 100755 index 0000000..18bb4c4 --- /dev/null +++ b/src/web/lang/_bin/transpile.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +lang_part() { + echo "$1" | awk "{split(\$0,a,\" = \"); print a[$2]}" +} +export -f lang_part + +handle_line() { + line="$1" + left=$(lang_part "$line" 1) + right=$(lang_part "$line" 2) + echo "$left" | grep -Ev '_content|_line' > /dev/null + if [ "$?" -eq 0 ]; then + right=$(echo "$right" | uwuify) + fi; + right=${right%;}; + echo "$left = $right;" +} +export -f handle_line + +transpile() { + file="$1" + out="$2" + printf "" > "$out" + printf " "$out"; + cat "$file" | grep '$lang' | xargs -d'\n' -I {} bash -c 'handle_line "$@"' _ {} >> "$out" +} + +transpile "$1" "$2" -- cgit v1.2.3-freya