Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
f7b34e98
Commit
f7b34e98
authored
Sep 27, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lang: properly extract our volt template strings
parent
8b018c4d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
2 deletions
+69
-2
Makefile
lang/Makefile
+15
-2
README.md
lang/README.md
+22
-0
Volt.pm
lang/Volt.pm
+32
-0
No files found.
lang/Makefile
View file @
f7b34e98
all
:
_XGETTEXT
!=
which xgettext
||
echo true
XGETTEXT
=
${
_XGETTEXT
}
-L
PHP
--from-code
=
UTF-8
-F
--strict
--debug
_XGETTEXT_PL
!=
which xgettext.pl
||
echo true
XGETTEXT_PL
=
${
_XGETTEXT_PL
}
-P
Locale::Maketext::Extract::Plugin::Volt
\
-u
-w
-W
_MSGFMT
!=
which msgfmt
||
echo true
MSGFMT
=
${
_MSGFMT
}
--strict
_MSGMERGE
!=
which msgmerge
||
echo true
MSGMERGE
=
${
_MSGMERGE
}
-U
-N
--backup
=
off
PERL_DIR
=
/usr/local/lib/perl5/site_perl
PERL_NAME
=
Locale/Maketext/Extract/Plugin
PERL_CP
!=
cp
-v
${
.CURDIR
}
/Volt.pm
${
PERL_DIR
}
/
${
PERL_NAME
}
/
LOCALEDIR
=
/usr/local/share/locale/%%LANG%%/LC_MESSAGES
# stable
...
...
@@ -19,6 +24,12 @@ INSTALL=
MERGE
=
PLIST
=
PAGER
?=
less
all
:
@
cat
${
.CURDIR
}
/README.md |
${
PAGER
}
.for
LANG
in
${LANGUAGES}
${LANG}DIR
=
${
LOCALEDIR
:S/%%LANG%%/
${
LANG
}
/g
}
install-${LANG}
:
...
...
@@ -38,6 +49,8 @@ MERGE+= merge-${LANG}
${TEMPLATE}
:
@
:
>
${
TEMPLATE
}
.pot
cd
${
.CURDIR
}
/..
&&
\
${
XGETTEXT_PL
}
-D
src
-p
${
.CURDIR
}
-o
${
TEMPLATE
}
.pot
cd
${
.CURDIR
}
/..
&&
find src lang/dynamic/helpers |
\
xargs
${
XGETTEXT
}
-j
-o
${
.CURDIR
}
/
${
TEMPLATE
}
.pot
...
...
lang/README.md
0 → 100644
View file @
f7b34e98
OPNsense language translation kit
=================================
The kit requires additional tools in order to properly extract strings
from the source code. You'll need to run this once locally:
# pkg install gettext-tools p5-Locale-Maketext-Lexicon python27
Regenerate dynamic strings that can't be found in the template
generation step (XML contents, etc.):
# make dynamic
Regenerate the translation template using:
# make template
Merge the latest template changes into the actual translations:
# make merge
The build system will automatically pick up all registered languages.
lang/Volt.pm
0 → 100644
View file @
f7b34e98
package
Locale::Maketext::Extract::Plugin::
Volt
;
$
Locale::Maketext::Extract::Plugin::Volt::
VERSION
=
'
1.00
';
use
strict
;
use
base
qw(Locale::Maketext::Extract::Plugin::Base)
;
# ABSTRACT: Volt template parser
sub
file_types
{
return
qw( volt )
;
}
sub
extract
{
my
$self
=
shift
;
local
$_
=
shift
;
my
$line
=
1
;
# Volt Template:
$line
=
1
;
pos
(
$_
)
=
0
;
while
(
m/\G(.*?(?<!\{)\{\{(?!\{)\s*lang\._\('(.*?)'\)\s*\}\})/sg
)
{
my
(
$vars
,
$str
)
=
(
'',
$2
);
$line
+=
(
()
=
(
$1
=~
/\n/g
)
);
# cryptocontext!
$self
->
add_entry
(
$str
,
$line
,
$vars
);
}
}
1
;
__END__
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment