From 3bab76349b8a8a7a302ba2fb1b737eaaaef2259d Mon Sep 17 00:00:00 2001 From: shottah Date: Mon, 17 Jun 2024 15:30:42 -0400 Subject: [PATCH] feat: script to replace Valora in locales --- scripts/rebrand_locales.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scripts/rebrand_locales.sh diff --git a/scripts/rebrand_locales.sh b/scripts/rebrand_locales.sh new file mode 100644 index 00000000000..55f62c2cd6f --- /dev/null +++ b/scripts/rebrand_locales.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# ======================================== +# Replace the branded name in translation locale files +# ======================================== + +# Flags: +# -b (Optional): Name of the branding to use: celo or valora (default) + +branding=Kolektivo + +# Get the branding name from the command line arguments +while getopts 'b:' flag; do + case "${flag}" in + b) branding="$OPTARG" ;; + *) error "Unexpected option ${flag}" ;; + esac +done + +# Get the root directory of the mobile project +mobile_root="$(dirname "$(dirname "$0")")" + +# Change the directory to the root directory of the localization files +cd "$mobile_root/locales" + +# Get all the locale files in the locales directory which may be nested +locale_files=$(find . -type f -name '*.json') + +# Replace the branded name in the locale files +for locale_file in $locale_files; do + sed -i '' "s/Valora/$branding/g" "$locale_file" +done