--- /dev/null
+{if ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS && $__wcf->user->userID}
+ <script data-relocate="true">
+ require(['Ajax', 'WoltLabSuite/Core/Language/Chooser'], function(Ajax, LanguageChooser) {
+ var item = elCreate('li');
+ item.id = 'pageLanguageContainer';
+ var userPanelItems = elBySel('.userPanelItems');
+ userPanelItems.insertBefore(item, userPanelItems.firstChild);
+
+ var languages = {
+ {implode from=$__wcf->getLanguage()->getLanguages() item=_language}
+ '{@$_language->languageID}': {
+ iconPath: '{@$_language->getIconPath()|encodeJS}',
+ languageName: '{@$_language|encodeJS}',
+ languageCode: '{@$_language->languageCode|encodeJS}'
+ }
+ {/implode}
+ };
+
+ var callback = function(listItem) {
+ Ajax.apiOnce({
+ data: {
+ actionName: 'devtoolsSetLanguage',
+ className: 'wcf\\data\\user\\UserAction',
+ parameters: {
+ languageID: elData(listItem, 'language-id')
+ }
+ },
+ success: function() {
+ window.location.reload();
+ }
+ });
+ };
+
+ LanguageChooser.init('pageLanguageContainer', 'pageLanguageID', {@$__wcf->getLanguage()->languageID}, languages, callback);
+ });
+ </script>
+{/if}
define.amd = undefined;
</script>
+{include file='__devtoolsLanguageChooser'}
+
{js application='wcf' lib='jquery' hasTiny=true}
{js application='wcf' lib='jquery-ui' hasTiny=true}
{js application='wcf' lib='jquery-ui' file='touchPunch' bundle='WCF.Combined' hasTiny=true}
"__aclFormField",
"__booleanFormField",
"__dateFormField",
+ "__devtoolsLanguageChooser",
"__dialogForm",
"__form",
"__formContainer",
--- /dev/null
+{if ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS && $__wcf->user->userID}
+ <script data-relocate="true">
+ require(['Ajax', 'WoltLabSuite/Core/Language/Chooser'], function(Ajax, LanguageChooser) {
+ var item = elCreate('li');
+ item.id = 'pageLanguageContainer';
+ var userPanelItems = elBySel('.userPanelItems');
+ userPanelItems.insertBefore(item, userPanelItems.firstChild);
+
+ var languages = {
+ {implode from=$__wcf->getLanguage()->getLanguages() item=_language}
+ '{@$_language->languageID}': {
+ iconPath: '{@$_language->getIconPath()|encodeJS}',
+ languageName: '{@$_language|encodeJS}',
+ languageCode: '{@$_language->languageCode|encodeJS}'
+ }
+ {/implode}
+ };
+
+ var callback = function(listItem) {
+ Ajax.apiOnce({
+ data: {
+ actionName: 'devtoolsSetLanguage',
+ className: 'wcf\\data\\user\\UserAction',
+ parameters: {
+ languageID: elData(listItem, 'language-id')
+ }
+ },
+ success: function() {
+ window.location.reload();
+ }
+ });
+ };
+
+ LanguageChooser.init('pageLanguageContainer', 'pageLanguageID', {@$__wcf->getLanguage()->languageID}, languages, callback);
+ });
+ </script>
+{/if}
});
</script>
+ {include file='__devtoolsLanguageChooser'}
+
<script>
// prevent jQuery and other libraries from utilizing define()
__require_define_amd = define.amd;
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\UserInputException;
+use wcf\system\language\LanguageFactory;
use wcf\system\request\RequestHandler;
use wcf\system\WCF;
use wcf\util\UserRegistrationUtil;
$this->unmarkItems($this->objectIDs);
}
+
+ /**
+ * @since 3.2
+ */
+ public function validateDevtoolsSetLanguage() {
+ if (!ENABLE_DEBUG_MODE || !ENABLE_DEVELOPER_TOOLS) {
+ throw new PermissionDeniedException();
+ }
+
+ $this->readInteger('languageID');
+
+ if (LanguageFactory::getInstance()->getLanguage($this->parameters['languageID']) === null) {
+ throw new UserInputException('languageID', 'invalid');
+ }
+ }
+
+ /**
+ * @since 3.2
+ */
+ public function devtoolsSetLanguage() {
+ (new UserEditor(WCF::getUser()))->update([
+ 'languageID' => $this->parameters['languageID']
+ ]);
+ }
}