diff options
author | Freya Murphy <freya@freyacat.org> | 2024-04-05 15:00:27 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-04-05 15:00:27 -0400 |
commit | 4c8d58b646ac62e67fc34c12f8cad51e7512bee3 (patch) | |
tree | 432351cce0acccd9a986872f7ea020dae14b0c71 /src/web/lang | |
parent | user menu (diff) | |
download | xssbook2-4c8d58b646ac62e67fc34c12f8cad51e7512bee3.tar.gz xssbook2-4c8d58b646ac62e67fc34c12f8cad51e7512bee3.tar.bz2 xssbook2-4c8d58b646ac62e67fc34c12f8cad51e7512bee3.zip |
add en_CAT makefile and use ucfirst/ucwords
Diffstat (limited to '')
-rw-r--r-- | src/web/lang/Makefile | 19 | ||||
-rwxr-xr-x | src/web/lang/_bin/transpile.sh | 29 |
2 files changed, 48 insertions, 0 deletions
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 "<?php /* Copyright (c) 2024 Freya Murphy */\n\n" > "$out"; + cat "$file" | grep '$lang' | xargs -d'\n' -I {} bash -c 'handle_line "$@"' _ {} >> "$out" +} + +transpile "$1" "$2" |