Skip to content
Open

I18n #51

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ src/*.o
src/lsx-comp
src/lsx-proc
*.pyc

/.vscode/
/locales/Makefile
/locales/Makefile.in
*.res
*.dat
/configure~
6 changes: 5 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pkgconfigdir = $(libdir)/pkgconfig
dist_pkgconfig_DATA = apertium-separable.pc

SUBDIRS = src
SUBDIRS = src locales

EXTRA_DIST=autogen.sh

test:
(cd tests; ./run_tests.py)

export ALT_I18N_DATA=$(datadir)/lttoolbox/lttoolbox.dat
export LOCALES_DIR=$(datadir)/$(PACKAGE_NAME)
export ASP_I18N_DATA=$(LOCALES_DIR)/asp.dat
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ AC_CONFIG_FILES([
apertium-separable.pc
Makefile
src/Makefile
locales/Makefile
])
AC_OUTPUT
7 changes: 7 additions & 0 deletions locales/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
asp.dat: root.txt en.txt
genrb -d . root.txt en.txt
echo root.res en.res > package_list.txt
pkgdata -p asp --mode archive -d . package_list.txt

localesdir = $(LOCALES_DIR)
dist_locales_DATA = asp.dat
2 changes: 2 additions & 0 deletions locales/en.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
en{
}
1 change: 1 addition & 0 deletions locales/package_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root.res en.res
8 changes: 8 additions & 0 deletions locales/root.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root{
lsx_proc_desc{"re-tokenize a stream"}
postgen_desc{"act as a postgenerator"}
repeat_desc{"continue applying rules until they match"}
dictionary_case_desc{"use dictionary case instead of surface case"}
null_flush_desc{"flush output on the null character"}
help_desc{"print this message and exit"}
}
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ bin_PROGRAMS = lsx-proc

lsx_proc_SOURCES = lsx_processor.cc lsx_proc.cc

AM_CPPFLAGS = -DASP_I18N_DATA='"$(ASP_I18N_DATA)"' -DALT_I18N_DATA='"$(ALT_I18N_DATA)"'

EXTRA_DIST = lsx_compiler.h
14 changes: 8 additions & 6 deletions src/lsx_proc.cc
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#include <lttoolbox/lt_locale.h>
#include <lttoolbox/file_utils.h>
#include <lttoolbox/cli.h>
#include <lttoolbox/i18n.h>

#include "lsx_processor.h"

using namespace std;

int main (int argc, char** argv)
{
I18n i18n {ASP_I18N_DATA, "asp"};
LtLocale::tryToSetLocale();
CLI cli("re-tokenize a stream", PACKAGE_VERSION);
cli.add_bool_arg('p', "postgen", "act as a postgenerator");
cli.add_bool_arg('r', "repeat", "continue applying rules until they match");
cli.add_bool_arg('w', "dictionary-case", "use dictionary case instead of surface case");
cli.add_bool_arg('z', "null-flush", "flush output on the null character");
cli.add_bool_arg('h', "help", "print this message and exit");
CLI cli(i18n.format("lsx_proc_desc"), PACKAGE_VERSION);
cli.add_bool_arg('p', "postgen", i18n.format("postgen_desc"));
cli.add_bool_arg('r', "repeat", i18n.format("repeat_desc"));
cli.add_bool_arg('w', "dictionary-case", i18n.format("dictionary_case_desc"));
cli.add_bool_arg('z', "null-flush", i18n.format("null_flush_desc"));
cli.add_bool_arg('h', "help", i18n.format("help_desc"));
cli.add_file_arg("fst_file", false);
cli.add_file_arg("input_file", true);
cli.add_file_arg("output_file", true);
Expand Down