mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-05 11:39:30 +01:00
31 lines
1002 B
Bash
Executable File
31 lines
1002 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Generates some glue code for translation of /command hints.
|
|
|
|
# How to use this:
|
|
# - Add any new hints to assets/l10n/intl_en.arb
|
|
# They must be of the form commandHint_<command> with <command> in lowercase.
|
|
# - Run this script to regenerate the glue code
|
|
# - Run flutter test to see if you did everything right
|
|
|
|
# Looking to add descriptions for a new command, but don't know what it does?
|
|
# It is likely defined here (in registerDefaultCommands()):
|
|
# https://gitlab.com/famedly/company/frontend/famedlysdk/-/blob/main/lib/src/utils/commands_extension.dart
|
|
|
|
echo "\
|
|
// This file is auto-generated using scripts/generate_command_hints_glue.sh.
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
String commandHint(L10n l10n, String command) {
|
|
switch (command) {
|
|
$(sed -n \
|
|
's/[[:blank:]]*\"\(commandHint_\([[:lower:]]*\)\)\".*/ case "\2":\
|
|
return l10n.\1;/p' \
|
|
assets/l10n/intl_en.arb
|
|
)
|
|
default:
|
|
return \"\";
|
|
}
|
|
}\
|
|
" > lib/pages/chat/command_hints.dart
|