mmm Posted March 18, 2022 Posted March 18, 2022 I'm quite new to Alfred, but already loving it! I'm trying to make a workflow that pastes the name of current the weekday as localised string in the front most app. I use the Copy-to-Clipboard output for this with the following formula: {date:EEEE} Works great! Only thing is, that I need the weekday-name to be localised to Danish. I'm a programmer and wouldn't mind a simple if-else- or switch-structure to do the translation. Like: if( {date:EEEE} == "Monday" ) return "Mandag"; else if( {date:EEEE} == "Tuesday" ) return "Tirsdag"; else if( {date:EEEE} == "Wednesday" ) return "Onsdag"; ... I'm not sure, if this is possible and how the syntax would be. Or if it can be done easier in another way. Any help would be most appreciated! 🙂
vitor Posted March 18, 2022 Posted March 18, 2022 Welcome @mmm, 2 hours ago, mmm said: I'm a programmer Then I suggest a Run Script with /bin/bash or /bin/zsh as the language: case "$(date +%A)" in Monday) echo -n 'Mandag' ;; Tuesday) echo -n 'Tirsdag' ;; Wednesday) echo -n 'Onsdag' ;; Thursday) echo -n 'Torsdag' ;; Friday) echo -n 'Fredag' ;; Saturday) echo -n 'Lørdag' ;; Sunday) echo -n 'Søndag' ;; *) echo 'Not a valid weekday! Should never happen.' >&2 ;; esac mmm 1
mmm Posted March 24, 2022 Author Posted March 24, 2022 Sorry for the long wait. This is a PERFECT solution! Just tested it, works flawlessly! Thanks so much - I wish all the best things will happen to you! 😃 vitor 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now