Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
archery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
archery
Commits
98e9c747
Commit
98e9c747
authored
Oct 09, 2014
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added setup code for gettext
parent
0964082f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
11 deletions
+46
-11
.gitignore
.gitignore
+2
-0
Makefile
Makefile
+34
-8
app.php
app.php
+9
-3
templates/layout.latte
templates/layout.latte
+1
-0
No files found.
.gitignore
View file @
98e9c747
...
...
@@ -7,3 +7,5 @@ www/js/
www/css/
config.local.json
config.mk
*.po
locale/messages.mo
Makefile
View file @
98e9c747
CACHE_DIR
:=
.cache
WWW_DIR
:=
www
LIB_DIR
:=
vendor
SCRIPTS
:=
forms scores
STYLES
:=
main
CACHE_DIR
:=
.cache
WWW_DIR
:=
www
LIB_DIR
:=
vendor
SCRIPTS
:=
forms scores
STYLES
:=
main
LOCALE_DIR
:=
locale
LOCALES
:=
nl_NL
GETTEXT_DOMAIN
:=
archery
include
config.mk
# defines HTTPDUSER
SCRIPTS
:=
$(
patsubst
%,
$(WWW_DIR)
/js/%.js,
$(SCRIPTS)
)
STYLES
:=
$(
patsubst
%,
$(WWW_DIR)
/css/%.css,
$(STYLES)
)
.PHONY
:
all min clean cleaner
.PHONY
:
all min
translations
clean cleaner
all
:
$(LIB_DIR)/autoload.php $(CACHE_DIR) $(SCRIPTS) $(STYLES)
all
:
$(LIB_DIR)/autoload.php $(CACHE_DIR) $(SCRIPTS) $(STYLES) translations
# Dependencies
$(LIB_DIR)/autoload.php
:
$(LIB_DIR) composer.json
composer update
...
...
@@ -19,6 +24,8 @@ $(LIB_DIR)/autoload.php: $(LIB_DIR) composer.json
$(LIB_DIR)
:
composer
install
# JavaScript / CSS
$(WWW_DIR)/js/%.js
:
coffee/%.coffee
@
mkdir
-p
$
(
@D
)
coffee
--compile
--output
$
(
@D
)
$<
...
...
@@ -38,12 +45,31 @@ min: all
mv
.tmp.js
$$
f
;
\
done
# Tmp files
$(CACHE_DIR)
:
mkdir
$@
setfacl
-R
-m
u:
$(HTTPDUSER)
:rwX
--
$@
# Gettext translations
SRC_FILES
:=
$(
wildcard
*
.php
)
$(
wildcard
routes/
*
.php
)
#XXX: $(shell find templates -name \*.latte)
translations
:
$(patsubst %
,
$(LOCALE_DIR)/%/LC_MESSAGES/$(GETTEXT_DOMAIN).mo
,
$(LOCALES))
%.mo
:
%.po
msgfmt
$<
-o
$@
.PRECIOUS
:
$(LOCALE_DIR)/%/LC_MESSAGES/$(GETTEXT_DOMAIN).po
$(LOCALE_DIR)/%/LC_MESSAGES/$(GETTEXT_DOMAIN).po
:
$(SRC_FILES)
@
if
[
!
-e
$@
]
;
then
mkdir
-p
$
(
@D
)
;
touch
$@
;
fi
xgettext
-j
-n
-o
$@
$^
# Cleanup
clean
:
rm
-f
$(SCRIPTS)
$(STYLES)
*
.bak
cleaner
:
clean
rm
-rf
$(CACHE_DIR)
$(LIB_DIR)
rm
-rf
$(CACHE_DIR)
$(LIB_DIR)
`
find
$(LOCALE_DIR)
-name
*
.mo
`
app.php
View file @
98e9c747
...
...
@@ -6,11 +6,17 @@ require 'DatabaseAuthenticator.php';
/*
* Set locale based on browser language specification
* XXX: use for gettext
*/
//if ($locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']))
// setlocale(LC_ALL, $locale, "$locale.utf8");
if
(
$locale
=
locale_accept_from_http
(
$_SERVER
[
'HTTP_ACCEPT_LANGUAGE'
]))
{
putenv
(
"LANG=
$locale
"
);
setlocale
(
LC_ALL
,
$locale
);
}
$domain
=
'archery'
;
bindtextdomain
(
$domain
,
__DIR__
.
'/locale'
);
bind_textdomain_codeset
(
$domain
,
'UTF-8'
);
textdomain
(
$domain
);
/*
* Config
...
...
templates/layout.latte
View file @
98e9c747
...
...
@@ -6,6 +6,7 @@
<!doctype html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Archery scorekeeper
</title>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"
>
<base
href=
"{$config['root_url']}/"
>
...
...
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