WIP: feat: add basic support for i18n #19
7 changed files with 44 additions and 2 deletions
5
data/locales/en.yaml
Normal file
5
data/locales/en.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
en:
|
||||||
|
cli:
|
||||||
|
banner: "Usage: %{program_name} [options]\n\nGlobal options"
|
||||||
|
#
|
5
data/locales/fr.yaml
Normal file
5
data/locales/fr.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
fr:
|
||||||
|
cli:
|
||||||
|
banner: "Usage: %{program_name} [options]\n\nOptions globales"
|
||||||
|
#
|
14
shard.lock
14
shard.lock
|
@ -1,6 +1,18 @@
|
||||||
|
---
|
||||||
version: 2.0
|
version: 2.0
|
||||||
shards:
|
shards:
|
||||||
|
baked_file_system:
|
||||||
|
git: https://github.com/schovi/baked_file_system.git
|
||||||
|
version: 0.10.0
|
||||||
|
|
||||||
|
crinja:
|
||||||
|
git: https://github.com/straight-shoota/crinja.git
|
||||||
|
version: 0.8.1
|
||||||
|
|
||||||
|
i18n:
|
||||||
|
git: https://github.com/crystal-i18n/i18n.git
|
||||||
|
version: 0.2.1
|
||||||
|
|
||||||
shellwords:
|
shellwords:
|
||||||
git: https://github.com/sztheory/shellwords-crystal.git
|
git: https://github.com/sztheory/shellwords-crystal.git
|
||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,13 @@ targets:
|
||||||
dependencies:
|
dependencies:
|
||||||
shellwords:
|
shellwords:
|
||||||
github: szTheory/shellwords-crystal
|
github: szTheory/shellwords-crystal
|
||||||
|
version: 0.1.0
|
||||||
|
baked_file_system:
|
||||||
|
github: schovi/baked_file_system
|
||||||
|
version: 0.10.0
|
||||||
|
i18n:
|
||||||
|
github: crystal-i18n/i18n
|
||||||
|
version: 0.2.1
|
||||||
|
|
||||||
# dependencies:
|
# dependencies:
|
||||||
# pg:
|
# pg:
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
|
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
|
||||||
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
|
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
|
||||||
|
|
||||||
|
require "i18n"
|
||||||
require "option_parser"
|
require "option_parser"
|
||||||
require "./config"
|
require "./config"
|
||||||
require "./fzf"
|
require "./fzf"
|
||||||
|
@ -16,6 +17,10 @@ module GX
|
||||||
|
|
||||||
def initialize()
|
def initialize()
|
||||||
# Main execution starts here
|
# Main execution starts here
|
||||||
|
I18n.config.loaders << I18n::Loader::YAML.embed("data/locales")
|
||||||
|
I18n.config.default_locale = :en
|
||||||
|
I18n.activate(:fr) ## FIXME: load from environment
|
||||||
|
I18n.init
|
||||||
@config = Config.new
|
@config = Config.new
|
||||||
|
|
||||||
## FIXME: check that FZF is installed
|
## FIXME: check that FZF is installed
|
||||||
|
@ -26,7 +31,7 @@ module GX
|
||||||
add_args = { name: "", path: "" }
|
add_args = { name: "", path: "" }
|
||||||
delete_args = { name: "" }
|
delete_args = { name: "" }
|
||||||
pparser = OptionParser.new do |parser|
|
pparser = OptionParser.new do |parser|
|
||||||
parser.banner = "Usage: #{PROGRAM_NAME} [options]\n\nGlobal options"
|
parser.banner = I18n.t("cli.banner", program_name: PROGRAM_NAME)
|
||||||
|
|
||||||
parser.on("-c", "--config FILE", "Set configuration file") do |path|
|
parser.on("-c", "--config FILE", "Set configuration file") do |path|
|
||||||
@config.path = path
|
@config.path = path
|
||||||
|
|
7
src/file_storage.cr
Normal file
7
src/file_storage.cr
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require "baked_file_system"
|
||||||
|
|
||||||
|
class FileStorage
|
||||||
|
extend BakedFileSystem
|
||||||
|
|
||||||
|
bake_folder "../data"
|
||||||
|
end
|
|
@ -8,6 +8,7 @@ require "colorize"
|
||||||
require "json"
|
require "json"
|
||||||
|
|
||||||
require "./filesystems/gocryptfs"
|
require "./filesystems/gocryptfs"
|
||||||
|
require "./file_storage"
|
||||||
require "./config"
|
require "./config"
|
||||||
require "./cli"
|
require "./cli"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue