etnt / gettext Goto Github PK
View Code? Open in Web Editor NEWErlang internationalization library.
Home Page: http://www.redhoterlang.com/
License: MIT License
Erlang internationalization library.
Home Page: http://www.redhoterlang.com/
License: MIT License
Erlang Gettext tools for multi-lingual capabilities. The gettext application makes it possible to internationalize your Erlang application. The name gettext comes from the GNU package with the same name. However, the only thing they have in common is the format of the PO-files, i.e, the files containing the text that can be translated. Using gettext you can create an initial PO-file containing all the strings of your application that should be possible to translate. By translating the strings into some other language and loading the new PO-file into the gettext database you can adapt your application for different languages.
In gettext_compile:parse_transform(), the environment variable GETTEXT_TMP_NAME is read, but is assigned to a variable called Gettext_App_Name which is then concatenated with "lang" and "epot.dets" in mk_epot_fname(). This seems very confused - it's probably some unfinished idea about separate directories for separate applications. Also, there seems to be no good reason for why a "temp" directory should be forced to be under ./lang.
Adding gettext as a rebar dependency fails with this error:
ERROR: Failed to extract name from
/home/al/projects/matome/deps/gettext/src/gettext.app.src:
{25, erl_parse, ["syntax error before: ", "'.'"]}
gettext.app.src is not a valid erlang config file (it's intended to be processed by Perl in gettext's build). A quick workaround:
cp ebin/gettext.app src/gettext.app.src
gettext.erl exports a bunch of functions, mk_polish_style_header() and some additional helpers, that are called from gettext_compile.erl but are also called directly by the "polish" application. It would be much better if this was implemented via a callback, so that the polish-speficic code could stay within polish.
Some support for ngettext(Singular, Plural, Count)
+ evaluator for pluralization rules from Plural-Forms
.po header may be good thing.
Plural-Forms: nplurals=3; \
plural=n%10==1 && n%100!=11 ? 0 : \
n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
Perhaps you would be interested in the following:
http://dialyzer.softlab.ntua.gr/current/gettext/
Kostis
Hi,
This is more of a question than a issue but given:
?TXT2("Foo", LC) where the key "Foo" exists in default/en shouldn't ?TXT2("Foo", "blah") print the value from default/en? instead of "Foo". If the key doesn't exist in default/en I understand why "Foo" is being printed. Yes, gettext:default_lang() prints "en".
Also, is there a way to reload the default language. Looking through the code it looks like it's only possible to reload a custom language.
Given the above I fail to see the purpose of the default lang vs. having it as a custom lang.
Please, help me grok this.
Add {read_concurrency, true}
option to ETS table and lookup it directly, bypasing gen_server:call
.
This may be done without any API changes.
Compiling with rebar3 and erlang 19.3 leads to
$ erl -pa ./_build/default/lib/gettext/ebin/
> gettext_app:start(application, []).
** exception exit: {shutdown,{failed_to_start_child,gettext_server,
{'EXIT',{function_clause,[{gettext_server,start_link,
[{gettext_server,[]}],
[{file,"/home/nikolay/gettext/_build/default/lib/gettext/src/gettext_server.erl"},
{line,94}]},
{supervisor,do_start_child,2,
[{file,"supervisor.erl"},{line,310}]},
{supervisor,start_children,3,
[{file,"supervisor.erl"},{line,293}]},
{supervisor,init_children,2,
[{file,"supervisor.erl"},{line,259}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,239}]}]}}}}
Seems to be caused by #15
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.