Recent

Author Topic: Questions about a new Calendar component.  (Read 75291 times)

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Questions about a new Calendar component.
« Reply #75 on: November 12, 2016, 01:22:39 am »
Thanks WP  -  I've taken the easy path  -  modified the code I already have !

No problems and I now have a calendar with a background colour.

All I have to do now is solve the issue of the clock striking 13 at 1pm !!
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Questions about a new Calendar component.
« Reply #76 on: November 17, 2016, 02:45:07 pm »
I've been busy researching the various facilities available in CalendarLite and adding Time Zone to my clock. Now I have the calendar changing the language according to the time zone I would like to add more languages - specifically Italian and Polish - though the option to add more may well be a benefit to others.

Looking at CalendarLite.Pas it seems that there are three places that need additional 'code' - or rather data - at (current) lines 67-80, 122 and 1403-1433.

Naturally I have serious reservations about modifying the code I've down-loaded and think that a separate file which holds the Day and Month names might well be a more efficient option.

Adding Italian and Polish in the area I've pointed out wouldn't be a big issue for me and I already have the data but I have no idea if there are other parts of the code that would also need attention.

If that is all the needs to be done I presume that I would again have to add it to Lazarus using the [Package][Open Package File] options.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Questions about a new Calendar component.
« Reply #77 on: November 17, 2016, 02:51:10 pm »
As always you can use resourcestrings and then enable internationalization of the package, to generate automatically the .po files. Then translators are welcome.

In your project you can do the same.

You can read more here:
http://wiki.freepascal.org/Translations_/_i18n_/_localizations_for_programs

I polished the article some time ago to include only the basic stuff, the advanced stuff like putting the .po in the executable are in other wiki article.

wp

  • Hero Member
  • *****
  • Posts: 13268
Re: Questions about a new Calendar component.
« Reply #78 on: November 17, 2016, 03:02:57 pm »
lainz is right, the package should handle po files. Hard-coded language strings were added to the package by one contributor some time ago, I was not very happy with this. I'll make the default strings translatable in po files when I have time.

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Questions about a new Calendar component.
« Reply #79 on: November 17, 2016, 04:53:42 pm »
Since I need to have my clock operational with an Italian and Polish calendar by tomorrow  -  well all right it could wait - but since I'm configuring a new PC for an Italian friend and his Polish wife and installing it before the weekend it would be nice to show off  :)

So  -  I've taken the bull by the horns and added the Italian & Polish data to the .PAS file, compiled it into Lazarus 1.6 and am pleased to report that it works perfectly - even displaying the peculiar Polish diacritical marks which was a cause for some concern when they didn't display in the Source Editor!

I also found - and corrected - a small typo in line 78, the SpanishDays. The delimiter between Dom & Lun was '<' instead of '|' .

As I suggested previously, it would be more efficient to have a .PO file - though I didn't know at the time that's what I meant - would it be useful if I made my edited CalenderLite.pas file available to all until WP has the time to deal with the matter  - - -  and if so how?
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Questions about a new Calendar component.
« Reply #80 on: November 17, 2016, 05:06:40 pm »
Attach it here.

The main problem is that you're not using SVN, else you can provide a patch to that file and wp can patch the files in the repository and all will benefit from the changes you made.

wp

  • Hero Member
  • *****
  • Posts: 13268
Re: Questions about a new Calendar component.
« Reply #81 on: November 17, 2016, 05:13:38 pm »
The language adaptions are only a few const declarations. So, no problem, attach your modified file here, I'll find the dfifferences.

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Questions about a new Calendar component.
« Reply #82 on: November 17, 2016, 06:30:34 pm »
Additions made at lines 85, 132 and 1445.

Correction at 78.

Edited file - zipped (another lesson learned!) and attached.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

wp

  • Hero Member
  • *****
  • Posts: 13268
Re: Questions about a new Calendar component.
« Reply #83 on: November 17, 2016, 10:35:48 pm »
The Italian and Polish translations are in trunk now.

J-G, please note that you seem to use the out-dated version with the | as separator.
See http://forum.lazarus.freepascal.org/index.php/topic,21093.msg228512.html#msg228512.

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Questions about a new Calendar component.
« Reply #84 on: November 17, 2016, 10:38:13 pm »
J-G please learn how to use svn  ::)

There is a good and easy to use svn client? I'm using tortoisesvn and it's easy, but maybe there's other that's even easier...

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Questions about a new Calendar component.
« Reply #85 on: November 18, 2016, 03:05:24 am »
The Italian and Polish translations are in trunk now.

J-G, please note that you seem to use the out-dated version with the | as separator.

I did notice that and remember manually inserting commas to get me out of the problem I had last week but since the package worked I left well alone. How they got re-instated I cannot understand. I've now replaced all '|'s with commas, re-compiled, tested again and can confirm that there is no error.

Whilst doing this though, I did notice some more - very minor - irritations in the French and Spanish. In French the short day name for Saturday was 'sm' and it ought to be 'sam' and in Spanish, Wednesday and Friday were missing the accents and all months and days were capitalized which is incorrect.

I've done those corrections and attach the latest version for WP to use as he thinks fit.

It seems that there must be another change that needs to be done because the Object Inspector still only lists the five original languages and I can't see a way to change this. I had assumed that adding the language names at line 132 would do this but it doesn't and I can't see an array declaration for 5 languages which I could change to 7.

@ lainz 
I've now installed tortoiseSVN but since I don't know what it actually does and it didn't put a default program icon on my desktop, I don't know which of the 11 .EXEs I should run. If I knew what I was trying to achieve by running any of the programs it might help  :)   

I've just found the TortoiseSVN 'Help' so I'll have a read of that to see if I can make some sense of it !
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Questions about a new Calendar component.
« Reply #86 on: November 18, 2016, 03:13:47 am »
OK you should use like this:

1) Create a new folder called 'callite' in your documents folder, for example.
2) Right click the folder, find the icon 'SVN Checkout...' and click on it.
3) There will be a new window, where it says URL of repository, paste this:
Code: Pascal  [Select][+][-]
  1. svn://svn.code.sf.net/p/lazarus-ccr/svn/components/callite/
4) Click on OK. A new window will appear and there will be a progress. When it says 'Completed' click OK.
5) Done! You have the latest callite.

But there's more: You have the latest from this moment, but think for example that wp post a new update, you need to do this:

6) Right click on the folder, click on the icon 'SVN Update...'. Then a progress will appear and if there is any update it will be downloaded automatically.

But there's more: If you change any file (for example the readme.txt) you will get a red icon in that file, that means that is different from the commit. Then you can create a patch to send it to wp to apply it instead of uploading the whole file.

7) Right click on the folder, find Tortoise SVN > Create patch... a window will appear. Click OK and you will get the patch file to upload.

But there's more: If you don't want that change, you can revert them. Right click the folder, find Tortoise SVN > Revert... and you can select wich files to revert.

That's all for now, but always is something new with svn to learn!

Zoran

  • Hero Member
  • *****
  • Posts: 1977
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Questions about a new Calendar component.
« Reply #87 on: November 18, 2016, 09:27:50 am »
I think I added a code-breaking change recently. The DisplayTexts used to be a comma-separated list of texts to be displayed in the bottom line of the calendar. Since having a comma-separator makes it difficult to have a comma inside the text items I had changed the separator to be a bar character (|) unaware that it could break previously created forms. This could have been the root cause of your trouble...

In the current trunk revision, this change is reverted. Try to open your form again after updating to this version. If it still does not yet work, open the lfm file in a text editor (don't use the Lazarus IDE), find the block of properties of the CalendarLite and replace the lines "DayNames", "DisplayTexts", and "MonthNames" by these:
Code: [Select]
    DayNames = 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'
    DisplayTexts = '"Today is","mm"","" dd yyyy","Holidays during","There are no holidays set for"'
    MonthNames = 'January,February,March,April,May,June,July,August,September,October,November,December'

Before saving make sure to have a backup copy. The form should open correctly after this modification.

WP, I strongly suggest not using visible ascii character for separator - use Char(31) for this as this is actually it's purpose in first place.
See field separator characters (28-31): https://en.wikipedia.org/wiki/C0_and_C1_control_codes#Field_separators
Quote
Can be used as delimiters to mark fields of data structures. If used for hierarchical levels, US is the lowest level (dividing plain-text data items), while RS, GS, and FS are of increasing level to divide groups made up of items of the level beneath it.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

J-G

  • Hero Member
  • *****
  • Posts: 966
Re: Questions about a new Calendar component.
« Reply #88 on: November 18, 2016, 12:33:14 pm »
@lainz
Thanks for the excellent road-map to TortoiseSVN  -  as you said, it's very easy and I now understand the concepts.

@WP
Now I've used SVN to get the latest version of Callite I see that the Spanish changes I suggested (Capitalization and accents) are not incorporated (I have done so for my version) but more important the 'Advance Month' arrow now moves on (or back) TWO months.

edit :   The year advance/retard also moves 2 years   -   more specifically month and year change on mouse down and mouse up

I suspect that it may be something to do with the TimeExpired procedure at line 1867 but I don't have sufficient knowledge to suggest a correction.

I haven't used SVN to upload my revised version because I haven't yet worked out how to do that (I've only read half the manual  :) )
« Last Edit: November 18, 2016, 12:48:08 pm by J-G »
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Questions about a new Calendar component.
« Reply #89 on: November 18, 2016, 01:23:30 pm »
Quote
I haven't used SVN to upload my revised version because I haven't yet worked out how to do that (I've only read half the manual  :) )

Well, you can't until someone gives you permission  ::)

The best thing you can do now is create a patch.

 

TinyPortal © 2005-2018