Skip to content

Commit

Permalink
Merge pull request #142 from Liturgical-Calendar/development
Browse files Browse the repository at this point in the history
Development for v3.6
  • Loading branch information
JohnRDOrazio authored Dec 13, 2022
2 parents fe3b965 + 3323b2e commit d635eab
Show file tree
Hide file tree
Showing 69 changed files with 2,520 additions and 1,153 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: CI
name: Update POTs

# Controls when the workflow will run
on:
Expand Down Expand Up @@ -29,7 +29,7 @@ jobs:
run: |
sudo apt-get install -y gettext
xgettext --from-code=UTF-8 --add-comments='translators:' --keyword="pgettext:1c,2" -o i18n/litcal.pot includes/LitCalAPI.php includes/LitMessages.php includes/FestivityCollection.php includes/enums/LitColor.php includes/enums/LitCommon.php includes/enums/LitGrade.php
echo "::set-output name=POT_LINES_CHANGED::$(git diff -U0 | grep '^[+|-][^+|-]' | grep -Ev '^[+-]"POT-Creation-Date' | wc -l)"
echo "POT_LINES_CHANGED=$(git diff -U0 | grep '^[+|-][^+|-]' | grep -Ev '^[+-]"POT-Creation-Date' | wc -l)" >> $GITHUB_OUTPUT
# push the output folder to your repo
- name: Push changes
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ LiturgicalCalendar.iml
engineCache/*
allowedOrigins.php
vendor/*

debug.log
54 changes: 51 additions & 3 deletions LitCalAllFestivities.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
return str_starts_with( $item, "VATICAN_" );
});

$LOCALE = isset( $_GET["locale"] ) && LitLocale::isValid( strtoupper( $_GET["locale"] ) ) ? strtoupper( $_GET["locale"] ) : "LA";
$LOCALE = isset( $_GET["locale"] ) ? $_GET["locale"] : "la";
$LOCALE = strtolower( explode('_', $LOCALE)[0] );
$LOCALE = LitLocale::isValid( $LOCALE ) ? $LOCALE : "la";

foreach( $LatinMissals as $LatinMissal ) {
$DataFile = RomanMissal::getSanctoraleFileName( $LatinMissal );
if( $DataFile !== false ) {
$I18nPath = RomanMissal::getSanctoraleI18nFilePath( $LatinMissal );
if( $I18nPath !== false && file_exists( $I18nPath . "/" . strtolower( $LOCALE ) . ".json" ) ) {
$NAME = json_decode( file_get_contents( $I18nPath . "/" . strtolower( $LOCALE ) . ".json" ), true );
if( $I18nPath !== false && file_exists( $I18nPath . "/" . $LOCALE . ".json" ) ) {
$NAME = json_decode( file_get_contents( $I18nPath . "/" . $LOCALE . ".json" ), true );
$DATA = json_decode( file_get_contents( $DataFile ), true );
foreach( $DATA as $idx => $festivity ) {
$key = $festivity[ "TAG" ];
Expand All @@ -40,6 +42,52 @@
}
}

$DataFile = 'data/propriumdetempore.json';
$I18nFile = 'data/propriumdetempore/' . $LOCALE . ".json";
$DATA = json_decode( file_get_contents( $DataFile ), true );
$NAME = json_decode( file_get_contents( $I18nFile ), true );
foreach( $DATA as $key => $readings ) {
if( false === array_key_exists( $key, $FestivityCollection ) ) {
$FestivityCollection[ $key ] = $readings;
$FestivityCollection[ $key ][ "TAG" ] = $key;
$FestivityCollection[ $key ][ "NAME" ] = $NAME[ $key ];
}
}

$DataFile = 'data/memorialsFromDecrees/memorialsFromDecrees.json';
$I18nFile = 'data/memorialsFromDecrees/i18n/' . $LOCALE . ".json";
$DATA = json_decode( file_get_contents( $DataFile ), true );
$NAME = json_decode( file_get_contents( $I18nFile ), true );
foreach( $DATA as $idx => $festivity ) {
$key = $festivity[ "Festivity" ][ "TAG" ];
if( false === array_key_exists( $key, $FestivityCollection ) ) {
$FestivityCollection[ $key ] = $festivity[ "Festivity" ];
$FestivityCollection[ $key ][ "NAME" ] = $NAME[ $key ];
if( array_key_exists( "decreeLangs", $festivity[ "Metadata" ] ) ) {
$decreeURL = sprintf( $festivity[ "Metadata" ][ "decreeURL" ], 'LA' );
if( array_key_exists(strtoupper($LOCALE), $festivity[ "Metadata" ][ "decreeLangs" ]) ) {
$decreeLang = $festivity[ "Metadata" ][ "decreeLangs" ][ strtoupper( $LOCALE ) ];
$decreeURL = sprintf( $festivity[ "Metadata" ][ "decreeURL" ], $decreeLang );
}
} else {
$decreeURL = $festivity[ "Metadata" ][ "decreeURL" ];
}
$FestivityCollection[ $key ][ "DECREE" ] = $decreeURL;
}
else if ( $festivity[ "Metadata" ][ "action" ] === 'setProperty' ) {
if( $festivity[ "Metadata" ][ "property" ] === 'name' ) {
$FestivityCollection[ $key ][ "NAME" ] = $NAME[ $key ];
}
else if( $festivity[ "Metadata" ][ "property" ] === 'grade' ) {
$FestivityCollection[ $key ][ "GRADE" ] = $festivity[ "Festivity" ][ "GRADE" ];
}
}
else if( $festivity[ "Metadata" ][ "action" ] === 'makeDoctor' ) {
$FestivityCollection[ $key ][ "NAME" ] = $NAME[ $key ];
}
}


$responseObj = [ "LitCalAllFestivities" => $FestivityCollection ];

$response = json_encode( $responseObj );
Expand Down
2 changes: 1 addition & 1 deletion LitCalEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Author: John Romano D'Orazio
* Email: priest@johnromanodorazio.com
* Licensed under the Apache 2.0 License
* Version 3.4
* Version 3.6
* Date Created: 27 December 2017
*/

Expand Down
22 changes: 15 additions & 7 deletions LitCalMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
header( 'Cache-Control: must-revalidate, max-age=259200' );
header( 'Content-Type: application/json' );

//National Calendars are defined in the LitCalAPI engine itself,
//so we don't really have any way of detecting them except declaring them explicitly here
//If we eventually succeed in finding a rational way to separate national calendars from the central API,
//then perhaps we will also be able to automatically detect which national calendars are defined
//Until then, we'll just use this array, and add to it if a new national calendar is built into the LitCalAPI class
$baseNationalCalendars = [ "ITALY", "USA", "VATICAN" ];
$widerRegionCalendars = [];
foreach (glob("nations/*.json") as $filename) {
$widerRegionCalendars[] = strtoupper( basename($filename, ".json") );
}

$baseNationalCalendars = [ "VATICAN" ];
$directories = array_map('basename', glob( 'nations/*' , GLOB_ONLYDIR) );
foreach( $directories as $directory ) {
if( file_exists( "nations/$directory/$directory.json" ) ) {
$baseNationalCalendars[] = $directory;
}
}

if( file_exists( 'nations/index.json' ) ) {
$index = file_get_contents( 'nations/index.json' );
Expand All @@ -41,7 +47,8 @@
$nationalCalendarsMetadata[$diocesanCalendars[$key]["nation"]] = [
"missals" => [],
"widerRegions" => [],
"dioceses" => []
"dioceses" => [],
"settings" => []
];
}
$nationalCalendars[$diocesanCalendars[$key]["nation"]][] = $key;
Expand All @@ -56,6 +63,7 @@
$nationData = json_decode( file_get_contents( "nations/$nation/$nation.json" ) );
$nationalCalendarsMetadata[$nation]["missals"] = $nationData->Metadata->Missals;
$nationalCalendarsMetadata[$nation]["widerRegions"][] = $nationData->Metadata->WiderRegion->name;
$nationalCalendarsMetadata[$nation]["settings"] = $nationData->Settings;
}
}
$filterDirResults = ['..', '.', 'index.json'];
Expand Down
Binary file modified i18n/de/LC_MESSAGES/litcal.mo
Binary file not shown.
Loading

0 comments on commit d635eab

Please sign in to comment.