Skip to content

Commit

Permalink
First serious attempt at i18n. Closes #70.
Browse files Browse the repository at this point in the history
Version bump.
  • Loading branch information
jkrrv committed Nov 19, 2022
1 parent ebfd44c commit 64e4e98
Show file tree
Hide file tree
Showing 23 changed files with 1,347 additions and 297 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ composer.lock
/TouchPointWP_ErrorLog.txt
/.phpdoc/
/phpDocumentor.phar
/wp-cli.phar

/.idea/workspace.xml
/.idea/usage.statistics.xml
Expand Down
3 changes: 1 addition & 2 deletions .idea/TouchPoint-WP.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions TouchPoint-WP.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Plugin URI: https://github.com/tenthpres/touchpoint-wp
GitHub Plugin URI: https://github.com/tenthpres/touchpoint-wp
Description: A WordPress Plugin for integrating with TouchPoint Church Management Software.
Version: 0.0.20
Version: 0.0.21
Author: James K
Author URI: https://github.com/jkrrv
License: AGPLv3+
Expand All @@ -34,7 +34,9 @@

/*** Load everything **/
if (TOUCHPOINT_COMPOSER_ENABLED) {
/** @noinspection PhpIncludeInspection */
/** @noinspection PhpIncludeInspection
* @noinspection RedundantSuppression
*/
require_once __DIR__ . '/vendor/autoload.php';
} else {
require_once __DIR__ . "/src/TouchPoint-WP/TouchPointWP_Exception.php";
Expand Down
101 changes: 54 additions & 47 deletions assets/js/base-defer.js

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions assets/js/meeting-defer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TP_Meeting {
const action = actionBtns[ai].getAttribute('data-tp-action');

if (action === "rsvp" && this.mtgDateTime < TP_Meeting.now()) {
actionBtns[ai].title = "Event Past"; // i18n
actionBtns[ai].title = __("Event Past", 'TouchPoint-WP');
actionBtns[ai].setAttribute("disabled", "disabled");
actionBtns[ai].classList.add("disabled");
} else {
Expand Down Expand Up @@ -95,7 +95,7 @@ class TP_Meeting {
tpvm.trigger('Meeting_class_loaded');

if (document.readyState === 'loading') { // Loading hasn't finished yet
document.addEventListener('DOMContentLoaded', this.initMeetings());
document.addEventListener('DOMContentLoaded', () => this.initMeetings());
} else { // `DOMContentLoaded` has already fired
this.initMeetings();
}
Expand Down Expand Up @@ -170,7 +170,7 @@ class TP_Meeting {
if (showConfirm) {
Swal.fire({
icon: 'success',
title: `Response${s} Recorded`,
title: `Response${s} Recorded`, // i18n
timer: 3000,
customClass: tpvm._utils.defaultSwalClasses()
});
Expand All @@ -181,7 +181,7 @@ class TP_Meeting {
if (showConfirm) {
Swal.fire({
icon: 'error',
title: `Something strange happened.`,
title: __('Something strange happened.', 'TouchPoint-WP'),
timer: 3000,
customClass: tpvm._utils.defaultSwalClasses()
});
Expand All @@ -201,7 +201,7 @@ class TP_Meeting {

tpvm._utils.applyHashForAction("rsvp", this);

let title = "RSVP for " + (meeting.description ?? meeting.inv.name) + "<br /><small>" + this.dateTimeString() + "</small>";
let title = "RSVP for " + (meeting.description ?? meeting.inv.name) + "<br /><small>" + this.dateTimeString() + "</small>"; // i18n

TP_Person.DoInformalAuth(title, forceAsk).then(
(res) => rsvpUi(meeting, res).then(tpvm._utils.clearHash),
Expand All @@ -212,14 +212,15 @@ class TP_Meeting {
tpvm._utils.ga('send', 'event', 'rsvp', 'rsvp userIdentified', meeting.mtgId);

return Swal.fire({
html: `<p id="swal-tp-text">Who is coming?</p><p class="small swal-tp-instruction">Indicate who is or is not coming. This will overwrite any existing RSVP. <br />To avoid overwriting an existing RSVP, leave that person blank. <br />To protect privacy, we won't show existing RSVPs here.</p></i>` + TP_Person.peopleArrayToRadio(['Yes', 'No'], people, tpvm._secondaryUsers),
html: `<p id="swal-tp-text">${__('Who is coming?', 'TouchPoint-WP')}</p><p class="small swal-tp-instruction">${__('Indicate who is or is not coming. This will overwrite any existing RSVP.', 'TouchPoint-WP')}<br />${__('To avoid overwriting an existing RSVP, leave that person blank.', 'TouchPoint-WP')}<br />${__("To protect privacy, we won't show existing RSVPs here.", 'TouchPoint-WP')}</p></i>` + TP_Person.peopleArrayToRadio([__('Yes', 'TouchPoint-WP'), __('No', 'TouchPoint-WP')], people, tpvm._secondaryUsers),
customClass: tpvm._utils.defaultSwalClasses(),
showConfirmButton: true,
showCancelButton: true,
showDenyButton: true,
title: title,
denyButtonText: 'Add Someone Else',
confirmButtonText: 'Submit',
denyButtonText: __('Add Someone Else', 'TouchPoint-WP'),
confirmButtonText: __('Submit', 'TouchPoint-WP'),
cancelButtonText: __('Cancel', 'TouchPoint-WP'),
focusConfirm: false,
preConfirm: () => {
let form = document.getElementById('tp_people_list_radio'),
Expand All @@ -237,7 +238,7 @@ class TP_Meeting {

if (!hasResponses) {
let prompt = document.getElementById('swal-tp-text');
prompt.innerText = "Nothing to submit.";
prompt.innerText = __("Nothing to submit.", 'TouchPoint-WP');
prompt.classList.add('error')
return false;
}
Expand Down Expand Up @@ -266,15 +267,15 @@ class TP_Meeting {
let ret;

if (this.mtgDateTime.getFullYear() !== (new Date()).getFullYear()) {
ret = this.mtgDateTime.toLocaleString('en-US', {
ret = this.mtgDateTime.toLocaleString('en-US', { // i18n
day: 'numeric',
month: 'long',
year: 'numeric',
hour: 'numeric',
minute: 'numeric'
});
} else {
ret = this.mtgDateTime.toLocaleString('en-US', {
ret = this.mtgDateTime.toLocaleString('en-US', { // i18n
day: 'numeric',
month: 'long',
// year: 'numeric', // current year isn't needed.
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,10 @@
"ext-zip": "*"
},
"require-dev": {
},
"config": {
"allow-plugins": {
"composer/installers": true
}
}
}
1 change: 0 additions & 1 deletion generateDocs.bat

This file was deleted.

10 changes: 10 additions & 0 deletions generateDocs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$pharFile = "phpDocumentor.phar"
$compareDt = (Get-Date).AddDays(-1)

if (!(test-path $pharFile -newerThan $compareDt))
{
Write-Output "Downloading phpDocumentor as it was not found or is more than a day old..."
Invoke-WebRequest https://www.phpdoc.org/phpDocumentor.phar -OutFile $pharFile
}

php phpDocumentor.phar
10 changes: 10 additions & 0 deletions generateI18n.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$pharFile = "wp-cli.phar"
$compareDt = (Get-Date).AddDays(-1)

if (!(test-path $pharFile -newerThan $compareDt))
{
Write-Output "Downloading wp-cli as it was not found or is more than a day old..."
Invoke-WebRequest https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -OutFile $pharFile
}

& php .\wp-cli.phar i18n make-pot . i18n/TouchPoint-WP.pot
Loading

0 comments on commit 64e4e98

Please sign in to comment.