summaryrefslogtreecommitdiff
path: root/admin/admin_languages_inc.php
blob: ce8fcf930c6fcbb22d7c6bfcccd4062efee3cfd6 (plain)
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
<?php
$formLanguageToggles = array(
	'i18n_browser_languages' => array(
		'label' => 'Browser Language Recognition',
		'note' => 'This will automatically recognise what the browsers default language is set to and display that language.<br />Please make sure you import appropriate languages first and disable / remove languages you don\'t want to support since loading a language for the first time will induce a lot of database traffic and might cause your system to slow down temporarily.',
	),
	'i18n_content_translation' => array(
		'label' => 'Content Translation',
		'note' => 'This will activate the content translation service. Users will be given links to content in alternate languages, and prompted to create translation while editing content.',
		'warning' => 'Please note that this feature is experimental.'
	),
	'i18n_interactive_translation' => array(
		'label' => 'Interactive Translations',
		'note' => 'This will help you translate your site very effitiently by giving you direct access to the correct translation page.<br />Once you are done translating, make sure you turn this feature off and clear the language cache.<br />This feature only works when you set <em>$smarty_force_compile</em> to true in your <em>config/kernel/config_inc.php</em> file',
		'page' => 'TranslationTutorial',
		'link' => array(
			'title' => 'Language cache',
			'package' => 'languages',
			'file' => 'edit_languages.php'
		),
	),
	'i18n_interactive_bittranslation' => array(
		'label' => 'Interactive bitTranslations',
		'note' => 'If you have a <a href="https://bitweaver.org/forums/viewtopic.php?t=948">translators account</a> on bitweaver.org, the translation links will redirect you there that you can modify the tranlations there. Due to the different setup on bitweaver.org, there might be strings that are not available for translation on that server.',
	),
	'i18n_record_untranslated' => array(
		'label' => 'Record untranslated',
		'note' => 'This will record any untranslated language strings.',
	),
	'i18n_track_translation_usage' => array(
		'label' => 'Track Translation Usage',
		'note' => 'Track which strings are used in your version of bitweaver so only the currently used strings appear while editing translations. You must clear your language and templates cache after enabling this option.',
		'link' => array(
			'title' => 'Language cache',
			'package' => 'languages',
			'file' => 'edit_languages.php'
		),
	),
);
$gBitSmarty->assign( 'formLanguageToggles',$formLanguageToggles );

// Handle Update
if( isset( $_REQUEST["prefs"] )) {
	foreach( $formLanguageToggles as $toggle => $data ) {
		simple_set_toggle( $toggle, LANGUAGES_PKG_NAME );
	}

	$pref_byref_values = array(
		"bitlanguage",
	);
	foreach( $pref_byref_values as $britem ) {
		byref_set_value( $britem, null, LANGUAGES_PKG_NAME );
	}
	global $gBitLanguage;
	$gBitLanguage->setLanguage( $gBitSystem->getConfig( 'bitlanguage' ));

	$gBitSystem->storeConfig( 'google_api_key', $_REQUEST['google_api_key'] );

} else {
	$gBitSmarty->assign( "language", $gBitSystem->getConfig( "language", "en" ));
}

// Get list of available languages
$languages = [];
$languages = $gBitLanguage->listLanguages();
$gBitSmarty->assign( "languages", $languages );
?>