Skip to content

Commit 14b144e

Browse files
committed
Adding language hooks to twitter plugin
1 parent f1d5961 commit 14b144e

File tree

7 files changed

+28
-29
lines changed

7 files changed

+28
-29
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ Twitter/.idea/codeStyleSettings.xml
1212
.idea/.name
1313

1414
*.iml
15+
16+
.AppleDouble
17+
18+
/nbproject/

Main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function registerEventHooks()
264264
$message[] = $json->errors;
265265
$twitter_error = $message['message']." (code ".$message['code'].")";
266266
}
267-
\Idno\Core\Idno::site()->session()->addMessage("We couldn't upload your photo to Twitter. Twitter's response: {$twitter_error}.");
267+
\Idno\Core\Idno::site()->session()->addMessage(\Idno\Core\Idno::site()->language()->_("We couldn't upload your photo to Twitter. Twitter's response: %s.", [$twitter_error]));
268268
}
269269
}
270270
}

Pages/Account.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function postContent() {
3030
$user = \Idno\Core\site()->session()->currentUser();
3131
$user->twitter = array();
3232
$user->save();
33-
\Idno\Core\site()->session()->addMessage('Your Twitter settings have been removed from your account.');
33+
\Idno\Core\site()->session()->addMessage(\Idno\Core\Idno::site()->language()->_('Your Twitter settings have been removed from your account.'));
3434
}
3535
$this->forward(\Idno\Core\site()->config()->getDisplayURL() . 'account/twitter/');
3636
}

Pages/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function postContent() {
2929
'consumer_secret' => $consumer_secret
3030
);
3131
\Idno\Core\site()->config()->save();
32-
\Idno\Core\site()->session()->addMessage('Your Twitter application details were saved.');
32+
\Idno\Core\site()->session()->addMessage(\Idno\Core\Idno::site()->language()->_('Your Twitter application details were saved.'));
3333
$this->forward(\Idno\Core\site()->config()->getDisplayURL() . 'admin/twitter/');
3434
}
3535

Pages/Callback.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ function get($params = array())
3737
\Idno\Core\site()->syndication()->registerServiceAccount('twitter', $access_token['screen_name'], '@' . $access_token['screen_name']);
3838
$user->twitter[$access_token['screen_name']] = array('user_token' => $access_token['oauth_token'], 'user_secret' => $access_token['oauth_token_secret'], 'screen_name' => $access_token['screen_name']);
3939
$user->save();
40-
\Idno\Core\site()->session()->addMessage('Your Twitter credentials were saved.');
40+
\Idno\Core\site()->session()->addMessage(\Idno\Core\Idno::site()->language()->_('Your Twitter credentials were saved.'));
4141
}
4242
else {
43-
\Idno\Core\site()->session()->addErrorMessage('Your Twitter credentials could not be saved.');
43+
\Idno\Core\site()->session()->addErrorMessage(\Idno\Core\Idno::site()->language()->_('Your Twitter credentials could not be saved.'));
4444
}
4545

4646
if (!empty($_SESSION['onboarding_passthrough'])) {

templates/default/account/twitter.tpl.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525
<div class="row">
2626
<div class="col-md-7">
2727
<p>
28-
Easily share updates, posts, and pictures to Twitter. </p>
28+
<?= \Idno\Core\Idno::site()->language()->_('Easily share updates, posts, and pictures to Twitter.'); ?> </p>
2929
<p>
30-
With Twitter connected, you can cross-post content that you publish publicly on your site.
30+
<?= \Idno\Core\Idno::site()->language()->_('With Twitter connected, you can cross-post content that you publish publicly on your site.'); ?>
3131
</p>
3232

3333

3434
<div class="social">
3535
<p>
3636
<a href="<?= $vars['oauth_url'] ?>" class="tw connect"><i class="fab fa-twitter"></i>
37-
Connect Twitter</a>
37+
<?= \Idno\Core\Idno::site()->language()->_('Connect Twitter'); ?></a>
3838
</p>
3939
</div>
4040

@@ -54,16 +54,15 @@
5454
<div class="row">
5555
<div class="col-md-7">
5656
<p>
57-
Your account is currently connected to Twitter. Public content that you publish here
58-
can be cross-posted to your Twitter account.
57+
<?= \Idno\Core\Idno::site()->language()->_('Your account is currently connected to Twitter. Public content that you publish here can be cross-posted to your Twitter account.'); ?>
5958
</p>
6059

6160

6261
<div class="social">
6362
<p>
6463
<input type="hidden" name="remove" value="1" class="form-control" />
6564
<button type="submit" class="tw connect connected"><i class="fab fa-twitter"></i>
66-
Disconnect Twitter</button>
65+
<?= \Idno\Core\Idno::site()->language()->_('Disconnect Twitter'); ?></button>
6766
</p>
6867
</div>
6968

@@ -83,8 +82,7 @@
8382
<div class="row">
8483
<div class="col-md-7">
8584
<p>
86-
You have connected the below accounts to Twitter. Public content that you publish here
87-
can be cross-posted to your Twitter account.
85+
<?= \Idno\Core\Idno::site()->language()->_('You have connected the below accounts to Twitter. Public content that you publish here can be cross-posted to your Twitter account.'); ?>
8886
</p>
8987

9088
<?php
@@ -100,7 +98,7 @@
10098
<input type="hidden" name="remove" class="form-control" value="<?= $account['username'] ?>"/>
10199
<button type="submit"
102100
class="tw connect connected"><i class="fab fa-twitter"></i>
103-
@<?= $account['username'] ?> (Disconnect)</button>
101+
@<?= $account['username'] ?> (<?= \Idno\Core\Idno::site()->language()->_('Disconnect'); ?>)</button>
104102
</p>
105103
</div>
106104
<?php
@@ -112,7 +110,7 @@ class="tw connect connected"><i class="fab fa-twitter"></i>
112110
?>
113111

114112
<p>
115-
<a href="<?= $vars['oauth_url'] ?>" class=""><i class="fa fa-plus"></i> Add another Twitter account</a>
113+
<a href="<?= $vars['oauth_url'] ?>" class=""><i class="fa fa-plus"></i> <?= \Idno\Core\Idno::site()->language()->_('Add another Twitter account'); ?></a>
116114
</p>
117115
</div>
118116
</div>
@@ -140,20 +138,18 @@ class="tw connect connected"><i class="fab fa-twitter"></i>
140138
<div class="row">
141139
<div class="col-md-7">
142140
<p>
143-
Before you can begin connecting to Twitter, you need to set it up.
141+
<?= \Idno\Core\Idno::site()->language()->_('Before you can begin connecting to Twitter, you need to set it up.'); ?>
144142
</p>
145143
<p>
146-
<a href="<?= \Idno\Core\site()->config()->getDisplayURL() ?>admin/twitter/">Click here to begin
147-
Twitter configuration.</a>
144+
<a href="<?= \Idno\Core\site()->config()->getDisplayURL() ?>admin/twitter/"><?= \Idno\Core\Idno::site()->language()->_('Click here to begin Twitter configuration.'); ?></a>
148145
</p>
149146
<?php
150147

151148
} else {
152149

153150
?>
154151
<p>
155-
The administrator has not finished setting up Twitter on this site.
156-
Please come back later.
152+
<?= \Idno\Core\Idno::site()->language()->_('The administrator has not finished setting up Twitter on this site. Please come back later.'); ?>
157153
</p>
158154
</div>
159155
</div>

templates/default/admin/twitter.tpl.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<div class="col-md-10 col-md-offset-1">
44
<?=$this->draw('admin/menu')?>
5-
<h1>Twitter configuration</h1>
5+
<h1><?= \Idno\Core\Idno::site()->language()->_('Twitter configuration'); ?></h1>
66

77
</div>
88

@@ -13,10 +13,9 @@
1313
<div class="controls-group">
1414
<div class="controls-config">
1515
<p>
16-
To begin using Twitter, <a href="https://dev.twitter.com/apps" target="_blank">create a new application in
17-
the Twitter developer portal</a>.</p>
16+
<?= \Idno\Core\Idno::site()->language()->_('To begin using Twitter, <a href="https://dev.twitter.com/apps" target="_blank">create a new application in the Twitter developer portal</a>'); ?>.</p>
1817
<p>
19-
The callback URL should be set to:
18+
<?= \Idno\Core\Idno::site()->language()->_('The callback URL should be set to:'); ?>
2019
</p>
2120
<p>
2221
<input type="text" name="ignore" class="form-control" value="<?=\Idno\Core\site()->config()->url . 'twitter/callback'?>" />
@@ -28,30 +27,30 @@
2827

2928
<div class="controls-group">
3029
<p>
31-
Once you've finished, fill in the details below:
30+
<?= \Idno\Core\Idno::site()->language()->_('Once you\'ve finished, fill in the details below:'); ?>
3231
</p>
33-
<label class="control-label" for="api-key">API key</label>
32+
<label class="control-label" for="api-key"><?= \Idno\Core\Idno::site()->language()->_('API key'); ?></label>
3433

3534
<input type="text" id="api-key" placeholder="Consumer key" class="form-control" name="consumer_key" value="<?=htmlspecialchars(\Idno\Core\site()->config()->twitter['consumer_key'])?>" >
3635

3736

3837

39-
<label class="control-label" for="api-secret">API secret</label>
38+
<label class="control-label" for="api-secret"><?= \Idno\Core\Idno::site()->language()->_('API secret'); ?></label>
4039

4140
<input type="text" id="api-secret" placeholder="Consumer secret" class="form-control" name="consumer_secret" value="<?=htmlspecialchars(\Idno\Core\site()->config()->twitter['consumer_secret'])?>" >
4241

4342
</div>
4443

4544
<div class="controls-group">
4645
<p>
47-
After the Twitter application is configured, site users must authenticate their Twitter account under Settings.
46+
<?= \Idno\Core\Idno::site()->language()->_('After the Twitter application is configured, site users must authenticate their Twitter account under Settings.'); ?>
4847
</p>
4948

5049
</div>
5150

5251
<div>
5352
<div class="controls-save">
54-
<button type="submit" class="btn btn-primary">Save settings</button>
53+
<button type="submit" class="btn btn-primary"><?= \Idno\Core\Idno::site()->language()->_('Save settings'); ?></button>
5554
</div>
5655
</div>
5756
<?= \Idno\Core\site()->actions()->signForm('/admin/twitter/')?>

0 commit comments

Comments
 (0)