Skip to content

Commit

Permalink
optimize script and path
Browse files Browse the repository at this point in the history
  • Loading branch information
Fintasys committed Nov 8, 2024
1 parent 2708b4d commit 3180f5e
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion automation/create_emoji_set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const_name="$2" # New variable to store the const name
url="https://raw.githubusercontent.com/unicode-org/cldr/main/common/annotations/${locale}.xml"
template_file="emoji_set_template.dart"

output_dir="../locales"
output_dir="../lib/locales"
output_file="$output_dir/emoji_set_${locale}.dart"

# Create the output directory if it doesn't exist
Expand Down
35 changes: 21 additions & 14 deletions automation/generate_all_locales.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
outputDir="../lib/locales"

echo "Generating all locales"
> "$outputDir/emoji_set.dart"
echo "====================="
echo "en - English"
./create_emoji_set.sh en English > /dev/null 2>&1
echo "de - German"
./create_emoji_set.sh de German > /dev/null 2>&1
echo "es - Spanish"
./create_emoji_set.sh es Spanish > /dev/null 2>&1
echo "fr - France"
./create_emoji_set.sh fr France > /dev/null 2>&1
echo "ja - Japanese"
./create_emoji_set.sh ja Japanese > /dev/null 2>&1
echo "it - Italian"
./create_emoji_set.sh it Italian > /dev/null 2>&1
echo "zh - Chinese"
./create_emoji_set.sh zh Chinese > /dev/null 2>&1

locales=(
"de German"
"en English"
"es Spanish"
"fr France"
"it Italian"
"ja Japanese"
"zh Chinese"
)

for locale in "${locales[@]}"; do
IFS=" " read code lang <<< "$locale" # Split the locale string into code and language
echo "$lang - $code"
./create_emoji_set.sh "$code" "$lang" > /dev/null 2>&1
echo "export 'package:emoji_picker_flutter/locales/emoji_set_$code.dart';" >> "$outputDir/emoji_set.dart"
done

echo "====================="
echo "All locales generated"
1 change: 1 addition & 0 deletions lib/emoji_picker_flutter.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
library emoji_picker_flutter;

export 'package:emoji_picker_flutter/locales/emoji_set.dart';
export 'package:emoji_picker_flutter/src/bottom_action_bar/bottom_action_bar.dart';
export 'package:emoji_picker_flutter/src/bottom_action_bar/bottom_action_bar_config.dart';
export 'package:emoji_picker_flutter/src/bottom_action_bar/default_bottom_action_bar.dart';
Expand Down
7 changes: 7 additions & 0 deletions lib/locales/emoji_set.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export 'package:emoji_picker_flutter/locales/emoji_set_de.dart';
export 'package:emoji_picker_flutter/locales/emoji_set_en.dart';
export 'package:emoji_picker_flutter/locales/emoji_set_es.dart';
export 'package:emoji_picker_flutter/locales/emoji_set_fr.dart';
export 'package:emoji_picker_flutter/locales/emoji_set_it.dart';
export 'package:emoji_picker_flutter/locales/emoji_set_ja.dart';
export 'package:emoji_picker_flutter/locales/emoji_set_zh.dart';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3180f5e

Please sign in to comment.