Skip to content

Commit deb2b16

Browse files
author
REH.TW《旋風之音》
committed
Multi-language rewrite
1 parent 58ca704 commit deb2b16

17 files changed

+197
-69
lines changed

crashdump/index.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
<?php
2+
include("lang/setlang.php");
3+
define('PACKAGE', 'index');
4+
5+
// gettext setting
6+
bindtextdomain(PACKAGE, 'lang'); // or $your_path/lang, ex: /var/www/test/lang
7+
textdomain(PACKAGE);
8+
?>
19
<html>
210
<head>
3-
<title>Crash dump parser</title>
11+
<title><?php echo _('Crash dump parser'); ?></title>
412
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
513
<script>
614
$(document).ready(function(){
@@ -9,24 +17,24 @@
917
</script>
1018
</head>
1119
<body>
12-
<p>Please choose a method to send the crash dump.</p>
20+
<p><?php echo _('Please choose a method to send the crash dump.'); ?></p>
1321
<hr>
1422
<form action="result.php" method="post" enctype="multipart/form-data">
15-
<input type="radio" name="method" value="buffer" checked> Paste crash dump
23+
<input type="radio" name="method" value="buffer" checked> <?php echo _('Paste crash dump'); ?>
1624
<br>
17-
<pre>----------------------REPORT THE DATA BELOW THIS LINE-----------------------
18-
===BEGIN CRASH DUMP===
25+
<pre>----------------------<?php echo _('REPORT THE DATA BELOW THIS LINE'); ?>-----------------------
26+
===<?php echo _('BEGIN CRASH DUMP'); ?>===
1927
<textarea name="buffer" cols="100" rows="30"></textarea>
20-
===END CRASH DUMP===
28+
===<?php echo _('END CRASH DUMP'); ?>===
2129
</pre>
2230
<hr>
23-
<input type="radio" name="method" value="file"> {EXPERIMENTAL} Upload crash dump file<br>
31+
<input type="radio" name="method" value="file"> <?php echo _('{EXPERIMENTAL} Upload crash dump file'); ?><br>
2432
<input type="file" name="file"><br>
2533
<hr>
26-
<input type="radio" name="method" value="github"> {EXPERIMENTAL} GitHub link <br>
34+
<input type="radio" name="method" value="github"> <?php echo _('{EXPERIMENTAL} GitHub link'); ?> <br>
2735
<hr>
2836
<input type="submit">
29-
<input type="checkbox" name="api"> output as JSON
37+
<input type="checkbox" name="api"> <?php echo _('output as JSON'); ?>
3038
</form>
3139
</body>
3240
</html>
1.14 KB
Binary file not shown.

crashdump/lang/setlang.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
preg_match('/^([a-z\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);// Analysis HTTP_ACCEPT_LANGUAGE property
3+
$lang = $matches[1];// Take the first language settings
4+
$lang = strtolower($lang);// Converted to lowercase
5+
// default lang & type
6+
$lang = $lang;
7+
putenv('LANG=en_US');
8+
setlocale(LC_ALL, $lang);
9+
10+
$lang = isset($_GET['lang']) ? $_GET['lang'] : $lang;
11+
12+
// en_US Languages
13+
if ('en-us' == $lang) {
14+
putenv('LANG=en_US');
15+
setlocale(LC_ALL, 'en_US');
16+
// zh_TW Languages
17+
} else if ('zh-tw' == $lang) {
18+
putenv('LANG=zh_TW');
19+
setlocale(LC_ALL, 'zh_TW'); // bsd use zh_TW.BIG5
20+
header('Content-type: text/html; charset=big5');
21+
} else if ('zh-hk' == $lang) {
22+
putenv('LANG=zh_TW');
23+
setlocale(LC_ALL, 'zh_TW'); // bsd use zh_TW.BIG5
24+
header('Content-type: text/html; charset=big5');
25+
// zh_CN Languages
26+
} else if ('zh-cn' == $lang) {
27+
putenv('LANG=zh_CN');
28+
setlocale(LC_ALL, 'zh_CN'); // bsd use zh_CN.GBK
29+
header('Content-type: text/html; charset=gbk');
30+
} else if ('zh-sg' == $lang) {
31+
putenv('LANG=zh_CN');
32+
setlocale(LC_ALL, 'zh_CN'); // bsd use zh_CN.GBK
33+
header('Content-type: text/html; charset=gbk');
34+
}
35+
36+
?>

lang/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
We hope that you can help translating pmt.mcpe.me into your locale for us.
2+
我們隨時歡迎您為 pmt.mcpe.me 貢獻翻譯!
3+
[https://github.com/pmt-mcpe-me/pmt.mcpe.me-languages](https://github.com/pmt-mcpe-me/pmt.mcpe.me-languages)
1.52 KB
Binary file not shown.

lang/en_US/LC_MESSAGES/phar.mo

4.35 KB
Binary file not shown.
1.4 KB
Binary file not shown.
1.88 KB
Binary file not shown.

lang/en_US/LC_MESSAGES/unphar.mo

2.44 KB
Binary file not shown.

lang/en_US/LC_MESSAGES/varDump.mo

1.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)