1<?php
2# MantisBT - A PHP based bugtracking system
3
4# MantisBT is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 2 of the License, or
7# (at your option) any later version.
8#
9# MantisBT is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * Handle language translations for Javascript
19 *
20 * @package MantisBT
21 * @copyright Copyright 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
22 * @copyright Copyright 2002  MantisBT Team - mantisbt-dev@lists.sourceforge.net
23 * @link http://www.mantisbt.org
24 *
25 * @uses lang_api.php
26 */
27
28# Prevent output of HTML in the content if errors occur
29define( 'DISABLE_INLINE_ERROR_REPORTING', true );
30
31require_once( 'core.php' );
32require_api( 'lang_api.php' );
33
34/**
35 * Print Language translation for javascript
36 * @param string $p_lang_key Language string being translated.
37 * @return void
38 */
39function print_translation( $p_lang_key ) {
40	echo "translations['" . $p_lang_key . "'] = '" . addslashes( lang_get( $p_lang_key ) ) . "';\n";
41}
42
43# Send correct MIME Content-Type header for JavaScript content.
44# See http://www.rfc-editor.org/rfc/rfc4329.txt for details on why
45# application/javasscript is the correct MIME type.
46header( 'Content-Type: application/javascript; charset=UTF-8' );
47
48# Don't let Internet Explorer second-guess our content-type, as per
49# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
50header( 'X-Content-Type-Options: nosniff' );
51
52# rewrite headers to allow caching
53if( gpc_isset( 'cache_key' ) ) {
54	http_caching_headers( true );
55}
56
57echo "var translations = new Array();\n";
58print_translation( 'time_tracking_stopwatch_start' );
59print_translation( 'time_tracking_stopwatch_stop' );
60print_translation( 'loading' );
61