Index: trunk/extensions/Translate/Translate.css |
— | — | @@ -163,4 +163,20 @@ |
164 | 164 | padding-left: 2em; |
165 | 165 | padding-right: 2em; |
166 | 166 | padding-bottom: 2ex; |
167 | | -} |
\ No newline at end of file |
| 167 | +} |
| 168 | + |
| 169 | +/* First Steps '*/ |
| 170 | +#translate-fs-signup { |
| 171 | + display: block; |
| 172 | + margin: 1em; |
| 173 | + font-weight: bold; |
| 174 | + font-size: 200%; |
| 175 | +} |
| 176 | + |
| 177 | +#translate-fs-signup a { |
| 178 | + border: 2px dotted gray; |
| 179 | + border-radius: 10px; |
| 180 | + -moz-border-radius: 10px; |
| 181 | + -webkit-border-radius: 10px; |
| 182 | + background-color: #D1E231 !important; |
| 183 | +} |
Index: trunk/extensions/Translate/SpecialFirstSteps.php |
— | — | @@ -0,0 +1,238 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @author Niklas Laxström |
| 5 | + * @copyright Copyright © 2010 Niklas Laxström |
| 6 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 7 | + */ |
| 8 | + |
| 9 | +$wgExtensionCredits['specialpage'][] = array( |
| 10 | + 'path' => __FILE__, |
| 11 | + 'name' => 'Translate: The First STeps', |
| 12 | + 'version' => '2010-02-06', |
| 13 | + 'author' => 'Niklas Laxström', |
| 14 | +); |
| 15 | + |
| 16 | +$wgSpecialPages['FirstSteps'] = 'SpecialFirstSteps'; |
| 17 | +$wgExtensionMessagesFiles['FirstSteps'] = dirname( __FILE__ ) . '/FirstSteps.i18n.php'; |
| 18 | + |
| 19 | +class SpecialFirstSteps extends SpecialPage { |
| 20 | + protected $skin, $user, $out; |
| 21 | + |
| 22 | + public function __construct() { |
| 23 | + parent::__construct( 'FirstSteps' ); |
| 24 | + global $wgOut, $wgUser; |
| 25 | + $this->out = $wgOut; |
| 26 | + $this->user = $wgUser; |
| 27 | + $this->skin = $wgUser->getSkin(); |
| 28 | + } |
| 29 | + |
| 30 | + public function execute( $params ) { |
| 31 | + $this->out->addWikiMsg( 'translate-fs-intro' ); |
| 32 | + $step = false; |
| 33 | + |
| 34 | + $step = $this->showSignup( $step ); |
| 35 | + $step = $this->showSettings( $step ); |
| 36 | + $step = $this->showUserpage( $step ); |
| 37 | + $step = $this->showPermissions( $step ); |
| 38 | + $step = $this->showTarget( $step ); |
| 39 | + $step = $this->showEmail( $step ); |
| 40 | + |
| 41 | + $this->out->setPageTitle( htmlspecialchars( wfMsg( 'translate-fs-pagetitle', wfMsg( $step ) ) ) ); |
| 42 | + } |
| 43 | + |
| 44 | + protected function showSignup( $step ) { |
| 45 | + $header = new HtmlTag( 'h2' ); |
| 46 | + $step_message = 'translate-fs-signup-title'; |
| 47 | + $header->style( 'opacity', 0.4 )->content( wfMsg( $step_message ) ); |
| 48 | + |
| 49 | + if ( $step ) { |
| 50 | + $this->out->addHtml( $header ); |
| 51 | + return $step; |
| 52 | + } |
| 53 | + if ( $this->user->isLoggedIn() ) { |
| 54 | + $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
| 55 | + $this->out->addHtml( $header ); |
| 56 | + return $step; |
| 57 | + } |
| 58 | + |
| 59 | + $this->out->addHtml( $header->style( 'opacity', false ) ); |
| 60 | + |
| 61 | + $login_page = SpecialPage::getTitleFor( 'Userlogin' ); |
| 62 | + $query = array( 'returnto' => $this->getTitle() ); |
| 63 | + |
| 64 | + $li_href = $login_page->getFullUrl( $query ); |
| 65 | + $tag = new HtmlTag( 'span', "[$li_href |||]" ); |
| 66 | + $tag->param( 'class', 'plainlinks' ); |
| 67 | + list( $li_before, $li_after ) = explode( '|||', $tag, 2 ); |
| 68 | + |
| 69 | + $su_href = $login_page->getFullUrl( $query + array( 'type' => 'signup' ) ); |
| 70 | + $tag->content( "[$su_href |||]" ); |
| 71 | + $tag->id( 'translate-fs-signup' ); |
| 72 | + list( $su_before, $su_after ) = explode( '|||', $tag, 2 ); |
| 73 | + |
| 74 | + $this->out->addWikiMsg( 'translate-fs-signup-text', $li_before, $li_after, $su_before, $su_after ); |
| 75 | + return $step_message; |
| 76 | + } |
| 77 | + |
| 78 | + protected function showSettings( $step ) { |
| 79 | + global $wgRequest; |
| 80 | + |
| 81 | + $header = new HtmlTag( 'h2' ); |
| 82 | + $step_message = 'translate-fs-settings-title'; |
| 83 | + $header->style( 'opacity', 0.4 )->content( wfMsg( $step_message ) ); |
| 84 | + |
| 85 | + if ( $step ) { |
| 86 | + $this->out->addHtml( $header ); |
| 87 | + return $step; |
| 88 | + } |
| 89 | + if ( $this->user->getOption( 'language' ) !== 'en' || $wgRequest->getText( 'step' ) === 'settings' ) { |
| 90 | + $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
| 91 | + $this->out->addHtml( $header ); |
| 92 | + return $step; |
| 93 | + } |
| 94 | + |
| 95 | + $this->out->addHtml( $header->style( 'opacity', false ) ); |
| 96 | + $this->out->addWikiMsg( 'translate-fs-settings-text' ); |
| 97 | + $form = new HtmlTag( 'form' ); |
| 98 | + $items = new TagContainer(); |
| 99 | + $form->param( 'method', 'post')->content( $items ); |
| 100 | + $items[] = new RawHtml( Html::hidden( 'step', 'settings' ) ); |
| 101 | + $items[] = new RawHtml( Xml::submitButton( wfMsg( 'translate-fs-settings-skip' ) ) ); |
| 102 | + |
| 103 | + $this->out->addHtml( $form ); |
| 104 | + |
| 105 | + return $step_message; |
| 106 | + } |
| 107 | + |
| 108 | + |
| 109 | + protected function showUserpage( $step ) { |
| 110 | + global $wgRequest; |
| 111 | + |
| 112 | + $textareaId = 'userpagetext'; |
| 113 | + |
| 114 | + $header = new HtmlTag( 'h2' ); |
| 115 | + $step_message = 'translate-fs-userpage-title'; |
| 116 | + $header->style( 'opacity', 0.4 )->content( wfMsg( $step_message ) ); |
| 117 | + |
| 118 | + if ( $step ) { |
| 119 | + $this->out->addHtml( $header ); |
| 120 | + return $step; |
| 121 | + } |
| 122 | + |
| 123 | + $userpage = $this->user->getUserPage(); |
| 124 | + $preload = "{{#babel:en-2}}\nI am My Name and...."; |
| 125 | + |
| 126 | + if ( $wgRequest->wasPosted() && |
| 127 | + $this->user->matchEditToken( $wgRequest->getVal( 'token' ) ) && |
| 128 | + $wgRequest->getText( 'step' ) === 'userpage' ) |
| 129 | + { |
| 130 | + $article = new Article($userpage); |
| 131 | + $status = $article->doEdit( $wgRequest->getText( $textareaId ), $this->getTitle() ); |
| 132 | + if ( $status->isOK() ) { |
| 133 | + $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
| 134 | + $this->out->addHtml( $header ); |
| 135 | + $this->out->addWikiMsg( 'translate-fs-userpage-done' ); |
| 136 | + return false; |
| 137 | + } else { |
| 138 | + $this->out->addWikiText( $status->getWikiText() ); |
| 139 | + $preload = $wgRequest->getText( 'userpagetext' ); |
| 140 | + } |
| 141 | + } |
| 142 | + |
| 143 | + if ( $userpage->exists() ) { |
| 144 | + $revision = Revision::newFromTitle( $userpage ); |
| 145 | + $text = $revision->getText(); |
| 146 | + $preload = $text; |
| 147 | + if ( preg_match( '/{{#babel:/i', $text ) ) { |
| 148 | + $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
| 149 | + $this->out->addHtml( $header ); |
| 150 | + return false; |
| 151 | + } |
| 152 | + } |
| 153 | + |
| 154 | + $this->out->addHtml( $header->style( 'opacity', false ) ); |
| 155 | + |
| 156 | + $this->out->addWikiMsg( 'translate-fs-userpage-text' ); |
| 157 | + global $wgLang; |
| 158 | + $this->out->addHtml( |
| 159 | + TranslateUtils::languageSelector( $wgLang->getCode(), $wgLang->getCode() ) |
| 160 | + ); |
| 161 | + |
| 162 | + $form = new HtmlTag( 'form' ); |
| 163 | + $items = new TagContainer(); |
| 164 | + $form->param( 'method', 'post')->content( $items ); |
| 165 | + |
| 166 | + $items[] = new RawHtml( Html::hidden( 'step', 'userpage' ) ); |
| 167 | + $items[] = new RawHtml( Html::hidden( 'token', $this->user->editToken() ) ); |
| 168 | + $items[] = new RawHtml( Html::hidden( 'title', $this->getTitle() ) ); |
| 169 | + $textarea = new HtmlTag( 'textarea', $preload ); |
| 170 | + $items[] = $textarea->param( 'rows' , 5 )->id( $textareaId )->param( 'name', $textareaId ); |
| 171 | + $items[] = new RawHtml( Xml::submitButton( wfMsg( 'translate-fs-userpage-submit' ) ) ); |
| 172 | + |
| 173 | + $this->out->addHtml( $form ); |
| 174 | + return $step_message; |
| 175 | + } |
| 176 | + |
| 177 | + protected function showPermissions( $step ) { |
| 178 | + $header = new HtmlTag( 'h2' ); |
| 179 | + $step_message = 'translate-fs-permissions-title'; |
| 180 | + $header->content( wfMsg( $step_message ) )->style( 'opacity', 0.4 ); |
| 181 | + |
| 182 | + if ( $step ) { |
| 183 | + $this->out->addHtml( $header ); |
| 184 | + return $step; |
| 185 | + } |
| 186 | + |
| 187 | + if ( $this->user->isAllowed( 'translate' ) ) { |
| 188 | + $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
| 189 | + $this->out->addHtml( $header ); |
| 190 | + return $step; |
| 191 | + } |
| 192 | + $this->out->addHtml( $header->style( 'opacity', false ) ); |
| 193 | + $this->out->addWikiMsg( 'translate-fs-permissions-text' ); |
| 194 | + |
| 195 | + return $step_message; |
| 196 | + } |
| 197 | + |
| 198 | + protected function showTarget( $step ) { |
| 199 | + $header = new HtmlTag( 'h2' ); |
| 200 | + $step_message = 'translate-fs-target-title'; |
| 201 | + $header->content( wfMsg( $step_message ) ); |
| 202 | + |
| 203 | + if ( $step ) { |
| 204 | + $header->style( 'opacity', 0.4 ); |
| 205 | + $this->out->addHtml( $header ); |
| 206 | + return $step; |
| 207 | + } |
| 208 | + |
| 209 | + global $wgLang; |
| 210 | + $this->out->addHtml( $header ); |
| 211 | + $this->out->addWikiMsg( 'translate-fs-target-text', $wgLang->getCode() ); |
| 212 | + |
| 213 | + return $step_message; |
| 214 | + } |
| 215 | + |
| 216 | + protected function showEmail( $step ) { |
| 217 | + $header = new HtmlTag( 'h2' ); |
| 218 | + $step_message = 'translate-fs-email-title'; |
| 219 | + $header->style( 'opacity', 0.4 )->content( wfMsg( $step_message ) ); |
| 220 | + |
| 221 | + if ( $step && $step !== 'translate-fs-target-title' ) { |
| 222 | + $this->out->addHtml( $header ); |
| 223 | + return $step; |
| 224 | + } |
| 225 | + |
| 226 | + if ( $this->user->isEmailConfirmed() ) { |
| 227 | + $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
| 228 | + $this->out->addHtml( $header ); |
| 229 | + return $step; // Start translating step |
| 230 | + } |
| 231 | + |
| 232 | + $this->out->addHtml( $header->style( 'opacity', false ) ); |
| 233 | + $this->out->addWikiMsg( 'translate-fs-email-text' ); |
| 234 | + |
| 235 | + return $step_message; |
| 236 | + } |
| 237 | + |
| 238 | +} |
| 239 | + |
Property changes on: trunk/extensions/Translate/SpecialFirstSteps.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 240 | + native |
Index: trunk/extensions/Translate/FirstSteps.i18n.php |
— | — | @@ -0,0 +1,108 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Translations of Translate extension. |
| 5 | + * |
| 6 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 7 | + */ |
| 8 | + |
| 9 | +$messages = array(); |
| 10 | + |
| 11 | +/** English |
| 12 | + * @author Nike |
| 13 | + * @author Siebrand |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + 'translate-fs-pagetitle-done' => ' - done!', |
| 17 | + 'translate-fs-pagetitle' => 'Steps to translator - $1', |
| 18 | + 'translate-fs-signup-title' => 'Sign up', |
| 19 | + 'translate-fs-settings-title' => 'Configure your preferences', |
| 20 | + 'translate-fs-userpage-title' => 'Create user page for yourself', |
| 21 | + 'translate-fs-permissions-title' => 'Request permissions', |
| 22 | + 'translate-fs-target-title' => 'Start translating!', |
| 23 | + 'translate-fs-email-title' => 'Confirm your e-mail address', |
| 24 | + |
| 25 | + 'translate-fs-intro' => "Welcome to the {{SITENAME}} first steps wizard. |
| 26 | +You will be guided trough the process of becoming a translator step by step. |
| 27 | +In the end you will be able to translate ''interface messages'' of all supported projects at {{SITENAME}}.", |
| 28 | + |
| 29 | + 'translate-fs-signup-text' => '[[Image:HowToStart1CreateAccount.png|frame]] |
| 30 | + |
| 31 | +In the first step you must sign up. |
| 32 | + |
| 33 | +Credits for your translations are attributed to your user name. |
| 34 | +The image on the right shows how to fill the fields. |
| 35 | + |
| 36 | +If you have already signed up, $1log in$2 instead. |
| 37 | +Once you are signed up, please return to this page. |
| 38 | + |
| 39 | +$3Sign up$4', |
| 40 | + 'translate-fs-settings-text' => 'You should now go to your preferences and |
| 41 | +at least change your interface language to the language you are going to translate to. |
| 42 | + |
| 43 | +Your interface languages is used as the default target language. |
| 44 | +It is easy to forget to change the langauge to the correct one, so setting it now is higly recommended. |
| 45 | + |
| 46 | +While you are there, you can also request the software to display translations in other languages you know. |
| 47 | +This setting can be found under {{int:prefs-editing}} tab. |
| 48 | +Feel free to explore other settings too. |
| 49 | + |
| 50 | +Go to your [[Special:Preferences|preferences page]] now and then return back to this page.', |
| 51 | + 'translate-fs-settings-skip' => "I'm done. Let me proceed.", |
| 52 | + 'translate-fs-userpage-text' => 'Now you need to create an user page. |
| 53 | + |
| 54 | +Please tell something about yourself, who you are and what you do. |
| 55 | +This will help {{SITENAME}} community to work together. |
| 56 | +In {{SITENAME}} there are people all around the world doing different things. |
| 57 | + |
| 58 | +In the prefilled box above in the very first line there is <nowiki>{{#babel:en-2}}</nowiki>. |
| 59 | +You should fill it accordingly to your language knowledge. |
| 60 | +The number behind the language code describes how well you know the language. |
| 61 | +The alternatives are: |
| 62 | +* 0 not at all |
| 63 | +* 1 little |
| 64 | +* 2 basic |
| 65 | +* 3 good |
| 66 | +* 4 like a native speaker |
| 67 | +* 5 you use the language professionally, for example you are a professional translator. |
| 68 | + |
| 69 | +If you are a native speaker of a language, leave the number away. |
| 70 | +Example: if you speak Tamil natively, good English and little Swahili, you would write: |
| 71 | +<tt><nowiki>{{#babel:ta|en-3|sw-1}}</nowiki></tt> |
| 72 | + |
| 73 | +If you do not know the language code of a language, now is good time to check it up. You can use the list below.', |
| 74 | + 'translate-fs-userpage-submit' => 'Create my userpage', |
| 75 | + 'translate-fs-userpage-done' => 'Well done! You now have an userpage.', |
| 76 | + 'translate-fs-permissions-text' => 'Now you need to place a request to be added to the translator group. |
| 77 | + |
| 78 | +Until we fix the code, please go to [[Project:Translator]] and follow the instructions. |
| 79 | +Then come back to this page. |
| 80 | + |
| 81 | +After you have filed your request, one of the volunteer staff member will check your request and approve it as soon as possible. |
| 82 | +Please be patient. |
| 83 | + |
| 84 | +<del>Check that the following request is correctly filled and then press the request button.</del>', |
| 85 | + |
| 86 | + 'translate-fs-target-text' => 'Congratulations! |
| 87 | +You can now start translating. |
| 88 | + |
| 89 | +Don\'t be afraid if still feels confusing. |
| 90 | +At [[Project list]] there is an overview of what you can translate. |
| 91 | +Most of the projects have a short description page with \'\'Translate this project\'\' link, |
| 92 | +that will take you to a page which lists all untranslated messages. |
| 93 | +The list of all projects is at [[Special:Translate]]. |
| 94 | + |
| 95 | +If you feel that you need to understand more before you start translating, |
| 96 | +you can read [[FAQ|Frequently asked questions]]. |
| 97 | +Unfortanely we do not currently have good documentation. |
| 98 | +If there is something that you can\'t find answer for, |
| 99 | +don\'t hesitate to ask it at [[Support]]. |
| 100 | + |
| 101 | +You can also try to seek help of fellow translators that speak the same language at [[Portal:$1]] |
| 102 | +(change the language code if it is incorrect).', |
| 103 | + |
| 104 | + 'translate-fs-email-text' => 'You should add e-mail to your preferences and confirm it. |
| 105 | + |
| 106 | +This helps us to contact you. |
| 107 | +You also receive newsletters at most once a month. |
| 108 | +If you don\'t want receive them, you can opt-out from your [[Special:Preferences]].', |
| 109 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/Translate/FirstSteps.i18n.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 110 | + native |
Index: trunk/extensions/Translate/Translate.alias.php |
— | — | @@ -19,6 +19,7 @@ |
20 | 20 | 'LanguageStats' => array( 'LanguageStats' ), |
21 | 21 | 'PageTranslation' => array( 'PageTranslation' ), |
22 | 22 | 'ImportTranslations' => array( 'ImportTranslations' ), |
| 23 | + 'FirstSteps' => array( 'FirstSteps' ), |
23 | 24 | ); |
24 | 25 | |
25 | 26 | /** Afrikaans (Afrikaans) */ |