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
Show 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/
...
@@ -7,3 +7,5 @@ www/js/
www/css/
www/css/
config.local.json
config.local.json
config.mk
config.mk
*.po
locale/messages.mo
Makefile
View file @
98e9c747
...
@@ -3,15 +3,20 @@ WWW_DIR := www
...
@@ -3,15 +3,20 @@ WWW_DIR := www
LIB_DIR
:=
vendor
LIB_DIR
:=
vendor
SCRIPTS
:=
forms scores
SCRIPTS
:=
forms scores
STYLES
:=
main
STYLES
:=
main
LOCALE_DIR
:=
locale
LOCALES
:=
nl_NL
GETTEXT_DOMAIN
:=
archery
include
config.mk
# defines HTTPDUSER
include
config.mk
# defines HTTPDUSER
SCRIPTS
:=
$(
patsubst
%,
$(WWW_DIR)
/js/%.js,
$(SCRIPTS)
)
SCRIPTS
:=
$(
patsubst
%,
$(WWW_DIR)
/js/%.js,
$(SCRIPTS)
)
STYLES
:=
$(
patsubst
%,
$(WWW_DIR)
/css/%.css,
$(STYLES)
)
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
$(LIB_DIR)/autoload.php
:
$(LIB_DIR) composer.json
composer update
composer update
...
@@ -19,6 +24,8 @@ $(LIB_DIR)/autoload.php: $(LIB_DIR) composer.json
...
@@ -19,6 +24,8 @@ $(LIB_DIR)/autoload.php: $(LIB_DIR) composer.json
$(LIB_DIR)
:
$(LIB_DIR)
:
composer
install
composer
install
# JavaScript / CSS
$(WWW_DIR)/js/%.js
:
coffee/%.coffee
$(WWW_DIR)/js/%.js
:
coffee/%.coffee
@
mkdir
-p
$
(
@D
)
@
mkdir
-p
$
(
@D
)
coffee
--compile
--output
$
(
@D
)
$<
coffee
--compile
--output
$
(
@D
)
$<
...
@@ -38,12 +45,31 @@ min: all
...
@@ -38,12 +45,31 @@ min: all
mv
.tmp.js
$$
f
;
\
mv
.tmp.js
$$
f
;
\
done
done
# Tmp files
$(CACHE_DIR)
:
$(CACHE_DIR)
:
mkdir
$@
mkdir
$@
setfacl
-R
-m
u:
$(HTTPDUSER)
:rwX
--
$@
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
:
clean
:
rm
-f
$(SCRIPTS)
$(STYLES)
*
.bak
rm
-f
$(SCRIPTS)
$(STYLES)
*
.bak
cleaner
:
clean
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';
...
@@ -6,11 +6,17 @@ require 'DatabaseAuthenticator.php';
/*
/*
* Set locale based on browser language specification
* Set locale based on browser language specification
* XXX: use for gettext
*/
*/
//if ($locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']))
if
(
$locale
=
locale_accept_from_http
(
$_SERVER
[
'HTTP_ACCEPT_LANGUAGE'
]))
{
// setlocale(LC_ALL, $locale, "$locale.utf8");
putenv
(
"LANG=
$locale
"
);
setlocale
(
LC_ALL
,
$locale
);
}
$domain
=
'archery'
;
bindtextdomain
(
$domain
,
__DIR__
.
'/locale'
);
bind_textdomain_codeset
(
$domain
,
'UTF-8'
);
textdomain
(
$domain
);
/*
/*
* Config
* Config
...
...
templates/layout.latte
View file @
98e9c747
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
<!doctype html>
<!doctype html>
<html
lang=
"en"
>
<html
lang=
"en"
>
<head>
<head>
<meta
charset=
"UTF-8"
>
<title>
Archery scorekeeper
</title>
<title>
Archery scorekeeper
</title>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"
>
<base
href=
"{$config['root_url']}/"
>
<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