Closed ITRecords38 closed 4 years ago
The day and month are in English because I get them straight from the system.
I just display what the system gives me after executing this command date '+%H:%M %A %d %b(%m) %Y'
.
You can translate to french by using an if else statement and translate the days of the week.
Let me know if it works, or if you need any further help with it.
Hi,
I want well help on integration if you do not mind.
Thanks
Yeah sure, how can I help?
Hi,
for using the "if else" I have to integrate it how ?
Where you able to get the English version working.
Where you able to get the English version working.
I would like to integrate the French version :)
let me see how to do it and we test.
Thanks
This is the code to translate to French. It finds English days, months and replaces them with French days and months.
I've put it on lines 31, 32, 33.
# translate to french date = date.split("Monday").join("Lundi").split("Tuesday").join("Mardi").split("Wednesday").join("Mercredi").split("Thursday").join("Jeudi").split("Friday").join("Vendredi").split("Saturday").join("Samedi").split("Sunday").join("Dimanche") date = date.split("Jan").join("janvier").split("Feb").join("février").split("Mar").join("mars").split("Apr").join("avril").split("May").join("mai").split("Jun").join("juin").split("Jul").join("juillet").split("Aug").join("août").split("Sept").join("septembre").split("Oct").join("octobre").split("Nov").join("novembre").split("Dec").join("décembre")
Here is the whole code. Open time.coffee and replace all the code with this one and it should work. Let me know if it works on not. I'd love to see a screenshot if you get it working.
# with Übersicht. For the full documentation please visit:
#
# https://github.com/felixhageloh/uebersicht
#
# You can modify this widget as you see fit, or simply delete this file to
# remove it.
# this is the shell command that gets executed every time this widget refreshes
command: "date '+%H:%M %A %d %b(%m) %Y'"
# the refresh frequency in milliseconds
refreshFrequency: 500 # every half second
# render gets called after the shell command has executed. The command's output
# is passed in as a string. Whatever it returns will get rendered as HTML.
render: -> """
<p>
<span class='time'></span>
<span class='date'></span>
</p>
"""
update: (output, domEl) ->
values = output.split(" ")
console.log(values: values)
time = values[0]
date = values[1] + ' ' + values[2] + ' ' + values[3] + ' ' + values[4]
# translate to french
date = date.split("Monday").join("Lundi").split("Tuesday").join("Mardi").split("Wednesday").join("Mercredi").split("Thursday").join("Jeudi").split("Friday").join("Vendredi").split("Saturday").join("Samedi").split("Sunday").join("Dimanche")
date = date.split("Jan").join("janvier").split("Feb").join("février").split("Mar").join("mars").split("Apr").join("avril").split("May").join("mai").split("Jun").join("juin").split("Jul").join("juillet").split("Aug").join("août").split("Sept").join("septembre").split("Oct").join("octobre").split("Nov").join("novembre").split("Dec").join("décembre")
# update HTML elements
div = $(domEl)
div.find('.time').html(time)
div.find('.date').html(date)
# the CSS style for this widget, written using Stylus
# (http://learnboost.github.io/stylus/)
style: """
// background
box-sizing: border-box
background-color: rgb(0, 0, 0)
// position
left: 0%
bottom: 0%
width: 50%
height: 36px
// typography
color: white
font-size: 10px
line-height: 1.5
font-family: Futura,Trebuchet MS,Arial,sans-serif;
padding: 10px
letter-spacing: 2px
// elements
display: flex
flex-direction: row
justify-content: flex-start
align-items: center
// date
.date
padding-left: 10px
font-size: 1em
opacity: 0.4
&:hover
opacity: 1
"""
Hi,
excellent thank you very much :)
a clean office thanks to you
I'm glad you're enjoying it!
Hi,
how can i translate in french the day and the date. Possible ?
Thanks