Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
archery
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
archery
Commits
98e9c747
Commit
98e9c747
authored
10 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added setup code for gettext
parent
0964082f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
Makefile
+34
-8
34 additions, 8 deletions
Makefile
app.php
+9
-3
9 additions, 3 deletions
app.php
templates/layout.latte
+1
-0
1 addition, 0 deletions
templates/layout.latte
with
46 additions
and
11 deletions
.gitignore
+
2
−
0
View file @
98e9c747
...
...
@@ -7,3 +7,5 @@ www/js/
www/css/
config.local.json
config.mk
*.po
locale/messages.mo
This diff is collapsed.
Click to expand it.
Makefile
+
34
−
8
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
`
This diff is collapsed.
Click to expand it.
app.php
+
9
−
3
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
...
...
This diff is collapsed.
Click to expand it.
templates/layout.latte
+
1
−
0
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']}/"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment