time in 24 hour format?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

time in 24 hour format?

Martin
OMs,
i have it all up and running. DM0WHM is on Air and V31HQ will follow as
soon as the repeaterbox and a radio are shipped to Belize.

There is one thing i couldn't find: How do i make svxlink announce time
in 24-hour format? DM0WHM speaks german, but announces time in 12 hour
format. This sounds quite funny, when the lady says in german "it is 11
afternoon"

--

Ohne CW ist es nur CB..

73, Martin DM4iM

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: time in 24 hour format?

Rob Janssen
Martin wrote:
> OMs,
> i have it all up and running. DM0WHM is on Air and V31HQ will follow as
> soon as the repeaterbox and a radio are shipped to Belize.
>
> There is one thing i couldn't find: How do i make svxlink announce time
> in 24-hour format? DM0WHM speaks german, but announces time in 12 hour
> format. This sounds quite funny, when the lady says in german "it is 11
> afternoon"
>

You can change the TCL script that does the announcements.
It is the function playTime which by default is in file /usr/share/svxlink/events.d/locale.tcl
but your language pack can also contain a localized version of this file in
/usr/share/svxlink/sounds/LANGUAGE/events.d/  (LANGUAGE is probably de_DE for you).
That one would take preference when it is available.

You would need to copy that function into a file .../events.d/local/locale.tcl
and modify it to your liking.  There is no "magic switch" to set that all at once, and it is
not straightforward as you first need to decide how it should be done instead and
record the required announcement messages.

We once simple removed the if {$hour < 12} { section and the playMsg "Core" $ampm;
but it is not sufficient as then it announces things like "the time is 20" which does not
sound good either.  So we went back to the default.
Our repeater is announcing in English anyway, although it is not our local language.

One advice: when you tinker with such TCL functions, always REMOVE the entire lines
that you (temporarily) do not want to have.  Do NOT put comment signs (#) at the start
of lines that contain a compound statement.  It does not work in TCL!
E.g. this:

#  if {$hour < 12} {
#    set ampm "AM";
#    if {$hour == 0} {
#      set hour 12;
#    }
#  } else {
#    set ampm "PM";
#    if {$hour > 12} {
#      set hour [expr $hour - 12];
#    }
#  };

will make you pull your hair all evening!
Just delete the lines in the active file and keep a copy elsewhere. NOT in the directory
where the scripts are.  When you simply copy the file local.tcl to local-saved.tcl you
will have similar hail pulling sessions!   (local.tcl.saved would work, though)
svxlink does not read the files by name specified in the program, it simply reads all
the .tcl files in that directory including any experimental and saved ones you put there!
So be warned...

Rob

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: time in 24 hour format?

Tobias Blomberg
In reply to this post by Martin
Hi Martin,

A properly put together language pack should include a tailored
locale.tcl that include modifications for how numbers and time should be
played back on air. To support different languages was actually why I in
the first place introduced the TCL event handling system so that
announcements could be placed in the correct order.

The function to play back 24 hour time in Swedish look like the function
below. Maybe you can get some inspiration from that to write a
locale.tcl that do what you want.

proc playTime {hour minute} {
   set hour [string trimleft $hour " "];
   set minute [string trimleft $minute " "];

   if {[string length $hour] == 1} {
     set hour "0$hour";
   }
   playTwoDigitNumber $hour;

   if {$hour > 9 && $minute >= 10} {
     playMsg "Default" and
   } else {
     playSilence 100
   }

   if {[string length $minute] == 1} {
     set minute "0$minute";
   }
   playTwoDigitNumber $minute;

   playSilence 100;
}

73's de SM0SVX / Tobias


On 2017-05-11 10:08, Martin wrote:
> OMs,
> i have it all up and running. DM0WHM is on Air and V31HQ will follow as
> soon as the repeaterbox and a radio are shipped to Belize.
>
> There is one thing i couldn't find: How do i make svxlink announce time
> in 24-hour format? DM0WHM speaks german, but announces time in 12 hour
> format. This sounds quite funny, when the lady says in german "it is 11
> afternoon"
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: time in 24 hour format?

Martin
Hi Tobias,
i'm not familiar with programming at all, i even don't know what
programming language i'm dealing with here.

 From what i saw in the original locale.tcl and your snippet, this seems
to work:

#
# Say the time specified by function arguments "hour" and "minute".
#
proc playTime {hour minute} {
    set hour [string trimleft $hour " "];
    set minute [string trimleft $minute " "];
playNumber $hour;
      playMsg "Default" uhr
      playSilence 100

    if {[string length $minute] == 1} {
      set minute "0$minute";
    }
    playTwoDigitNumber $minute;

    playSilence 100;
}


Am 13.05.2017 um 16:27 schrieb Tobias Blomberg:

> Hi Martin,
>
> A properly put together language pack should include a tailored
> locale.tcl that include modifications for how numbers and time should be
> played back on air. To support different languages was actually why I in
> the first place introduced the TCL event handling system so that
> announcements could be placed in the correct order.
>
> The function to play back 24 hour time in Swedish look like the function
> below. Maybe you can get some inspiration from that to write a
> locale.tcl that do what you want.
>
> proc playTime {hour minute} {
>    set hour [string trimleft $hour " "];
>    set minute [string trimleft $minute " "];
>
>    if {[string length $hour] == 1} {
>      set hour "0$hour";
>    }
>    playTwoDigitNumber $hour;
>
>    if {$hour > 9 && $minute >= 10} {
>      playMsg "Default" and
>    } else {
>      playSilence 100
>    }
>
>    if {[string length $minute] == 1} {
>      set minute "0$minute";
>    }
>    playTwoDigitNumber $minute;
>
>    playSilence 100;
> }
>
> 73's de SM0SVX / Tobias
>
>
> On 2017-05-11 10:08, Martin wrote:
>> OMs,
>> i have it all up and running. DM0WHM is on Air and V31HQ will follow as
>> soon as the repeaterbox and a radio are shipped to Belize.
>>
>> There is one thing i couldn't find: How do i make svxlink announce time
>> in 24-hour format? DM0WHM speaks german, but announces time in 12 hour
>> format. This sounds quite funny, when the lady says in german "it is 11
>> afternoon"
>>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Svxlink-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/svxlink-devel
>

--

Ohne CW ist es nur CB..

73, Martin DM4iM

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: time in 24 hour format?

Martin
Thanks, got it sorted out.
There is a locale.tcl , maintained by german hams

http://forum.svxlink.de/viewtopic.php?f=3&t=313&p=1976&hilit=uhrzeit#p1976

Now that i installed it, times are pronounced correct.

Thanks to all.


Am 14.05.2017 um 01:20 schrieb Martin:

> Hi Tobias,
> i'm not familiar with programming at all, i even don't know what
> programming language i'm dealing with here.
>
>  From what i saw in the original locale.tcl and your snippet, this seems
> to work:
>
> #
> # Say the time specified by function arguments "hour" and "minute".
> #
> proc playTime {hour minute} {
>     set hour [string trimleft $hour " "];
>     set minute [string trimleft $minute " "];
> playNumber $hour;
>       playMsg "Default" uhr
>       playSilence 100
>
>     if {[string length $minute] == 1} {
>       set minute "0$minute";
>     }
>     playTwoDigitNumber $minute;
>
>     playSilence 100;
> }
>
>
> Am 13.05.2017 um 16:27 schrieb Tobias Blomberg:
>> Hi Martin,
>>
>> A properly put together language pack should include a tailored
>> locale.tcl that include modifications for how numbers and time should be
>> played back on air. To support different languages was actually why I in
>> the first place introduced the TCL event handling system so that
>> announcements could be placed in the correct order.
>>
>> The function to play back 24 hour time in Swedish look like the function
>> below. Maybe you can get some inspiration from that to write a
>> locale.tcl that do what you want.
>>
>> proc playTime {hour minute} {
>>    set hour [string trimleft $hour " "];
>>    set minute [string trimleft $minute " "];
>>
>>    if {[string length $hour] == 1} {
>>      set hour "0$hour";
>>    }
>>    playTwoDigitNumber $hour;
>>
>>    if {$hour > 9 && $minute >= 10} {
>>      playMsg "Default" and
>>    } else {
>>      playSilence 100
>>    }
>>
>>    if {[string length $minute] == 1} {
>>      set minute "0$minute";
>>    }
>>    playTwoDigitNumber $minute;
>>
>>    playSilence 100;
>> }
>>
>> 73's de SM0SVX / Tobias
>>
>>
>> On 2017-05-11 10:08, Martin wrote:
>>> OMs,
>>> i have it all up and running. DM0WHM is on Air and V31HQ will follow as
>>> soon as the repeaterbox and a radio are shipped to Belize.
>>>
>>> There is one thing i couldn't find: How do i make svxlink announce time
>>> in 24-hour format? DM0WHM speaks german, but announces time in 12 hour
>>> format. This sounds quite funny, when the lady says in german "it is 11
>>> afternoon"
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Svxlink-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/svxlink-devel
>>
>

--

Ohne CW ist es nur CB..

73, Martin DM4iM

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: time in 24 hour format?

Rob Janssen
Martin wrote:
> Thanks, got it sorted out.
> There is a locale.tcl , maintained by german hams
>
> http://forum.svxlink.de/viewtopic.php?f=3&t=313&p=1976&hilit=uhrzeit#p1976
>
> Now that i installed it, times are pronounced correct.
>
> Thanks to all.
>

Ok but note that the directions where to put this file do not really use the capabilities of svxlink to the fullest.
They should have included this file in an events.d subdirectory inside the sounds package.
Then it would be used automatically without extra steps.

Rob

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Loading...