forked from erickok/pastt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
81 lines (66 loc) · 1.99 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
// PASTT: PHP Android Translation Tool
// http://code.google.com/p/android-php-translator/
// Licensed Apache License 2.0
// http://www.apache.org/licenses/LICENSE-2.0
define('DIRECT_ACCESSIBLE', TRUE);
include('includes/common.php');
// Default language to select?
include('includes/checklanguage.php');
$defaultLanguage = getDefaultLanguage('aa');
if (strlen($defaultLanguage) > 2) {
// Remove regional identifier
$defaultLanguage = substr($defaultLanguage, 0, 2);
}
include('includes/header.php');
foreach ($apps as $appId=>$appName) {
$languages = getLanguages($appId);
echo '
<h1>' . $appName . '</h1>';
echo '
<table>
<tr>
<th colspan="3">Existing translations</td>
</tr>';
$isuneven = false;
$classuneven = ' class="uneven"';
if (isset($languages)) {
sort($languages);
foreach ($languages as $language) {
// Show the language and an edit link
$langgroup = substr($language, 0, 2);
echo '
<tr' . ($isuneven? $classuneven: '') . '>
<td>' . $language . '</td>
<td>' . $iso639[$langgroup] . '</td>
<td><a href="translation.php?appId=' . $appId . '&lang=' . $language . '">Edit translation</a></td>
</tr>';
$isuneven = !$isuneven;
}
}
echo '
<tr>
<td colspan="3">
<form id="addtranslation" name="addtranslation" method="GET" action="translation.php">
Add a new translation for:
<select id="lang" name="lang">';
foreach ($iso639 as $langcode => $langname) {
$selected = '';
if ($defaultLanguage == $langcode) {
$selected = ' selected="selected"';
}
echo '
<option value="' . $langcode . '"' . $selected . '>' . $langcode . ' - ' . $langname . '</option>';
}
echo '
</select>
<strong>-r</strong><input type="text" id="region" name="region" /> (optional region code)
<input type="hidden" id="appId" name="appId" value="'.$appId.'" />
<input type="submit" id="submit" name="submit" value="Add" />
</form>
</td>
</tr>
</table>';
}
include('includes/footer.php');
?>