isax5 / Hymnal-Xamarin

New version of the adventist hymnal multi-platform and multi-language
18 stars 7 forks source link

Thai SDA hymnal and other hymnal content edits #125

Closed danielbair closed 3 years ago

danielbair commented 3 years ago

This data has differences from the main content:

Lyrics/Content is stored per verse/refrain
Thematic List is stored as a list of numbers not as a range.
Additional records per hymn such as authors, time signature, key signature.

I don't know the date of publication of the Thai SDA hymnal, but I do know that it must have been before 1985 as it references page numbers from the 1940 English SDA hymnal.

And I don't have any clue on the date of publication of the French or Burmese hymnals either.

I haven't yet found where you render/display the hymn content, but to use the json content I have submitted here, it would need a new render-er for the lyrics content to assemble the verse/refrain into html.

This is what have working in JavaScript/TypeScript for ionic/cordova:

  public getHymnById(hymn_id: number): Hymn {
    const hymn = this.hymnal.hymns[hymn_id];
    this.hymn = JSON.parse(JSON.stringify(hymn));
    this.refrain = "";
    this.lyrics = "";
    let num_keys: number = Object.keys(this.hymn.content).length;
    for (let key = 0; key < num_keys; key++) {
      let num_key: number = key;
      let ref_key: number = key+1;
      let max_key: number = num_keys-1;
      if (this.hymn.content[num_key].line == "ref" && num_key == 0) { //If we find the refrain on the first line, then save the refrain and start the hymn lyrics with the refrain
        this.refrain = "<blockquote><i>" + this.hymn.content[num_key].text + "</i></blockquote>\n";
        this.lyrics += this.refrain;
      }
      if (ref_key<max_key && this.hymn.content[ref_key].line == "ref") { //Check if the refrain is the next line entry and save it
        this.refrain = "<blockquote><i>" + this.hymn.content[ref_key].text + "</i></blockquote>\n";
      }
      if (this.hymn.content[num_key].line != "ref") { //Assemble the lyric content as verse then refrain repeated.
        this.lyrics += "<p>" + this.hymn.content[num_key].line + ". " + this.hymn.content[num_key].text + "</p>\n" + this.refrain;
      }
    }
    this.hymn.lyrics_content = this.lyrics;
    return this.hymn;
  }
isax5 commented 3 years ago

Hi, I finished updating to Xamarin 5 I'm checking your pr and there are many changes in the lyrics If everything works I think it's a good update

I'm a little worried about the Russian version because it looks very different, any way I think let's try and see what happen

danielbair commented 3 years ago

Hi, I finished updating to Xamarin 5

I'm checking your pr and there are many changes in the lyrics

If everything works I think it's a good update

I'm a little worried about the Russian version because it looks very different, any way I think let's try and see what happen

Hmmm. I will double check the Russian. I also had found a different Russian SDA Hymnal data file from somewhere else, but I thought I was keeping the two Russian hymnals separate and giving you the same Russian lyrics as you had before.

danielbair commented 3 years ago

I found the issue. The file was ASCII with unicode escape sequences. I converted it to utf-8 with unicode chars.

https://github.com/isax5/Hymnal-Xamarin/pull/131