packages feed

fuzzytime 0.7.5.1 → 0.7.6

raw patch · 8 files changed

+96/−13 lines, 8 files

Files

CHANGELOG view
@@ -6,6 +6,9 @@ 	read default language from $LANG (hFlush!) 	daemon? +0.7.6	2011.12.30+	added Japanese (Jens Petersen)+ 0.7.5.1	2011.11.29 	bugfix (thanks Sara) 
INSTALL view
@@ -1,4 +1,4 @@-fuzzytime 0.7.5.1 (2011.11.29)+fuzzytime 0.7.6 (2011.12.30) A clock and timer that tell the time in a more human way (the 'ten past six'-style)  
README view
@@ -15,7 +15,7 @@  ### --help A clock and timer that tell the time in a more human way.-v0.7.5.1, 2011.11.29, *antispam*, GPL3++v0.7.6, 2011.12.30, *antispam*, GPL3+  fuzzytime [COMMAND] ... [OPTIONS] @@ -28,8 +28,8 @@    -a --caps=INT    Capital letters; default 1 (see the man page).   -c --clock=INT   12 or 24-hour clock; default 12-hour.-  -l --lang=ITEM   Language (currently da, de, el, en, es, fr, it, nb, nl,-                   pl, se and tr); default en.+  -l --lang=ITEM   Language (currently da, de, el, en, es, fr, it, ja, nb,+                   nl, pl, se and tr); default en.   -p --prec=INT    Precision (1 <= prec <= 60 [minutes]); default 5.   -t --time=ITEM   Time to fuzzify as HH:MM; default current time.   -o --sound=ITEM  Command to play the alarm sound; see man for the default.
fuzzytime.cabal view
@@ -1,5 +1,5 @@ name:                fuzzytime-version:             0.7.5.1+version:             0.7.6 description:         A clock and timer that tell the time in a more human way (the 'ten past six' style) synopsis:            A 'ten past six' style clock category:            Utils@@ -21,10 +21,11 @@                      FuzzyTime.Danish,                      FuzzyTime.Dutch,                      FuzzyTime.English,+                     FuzzyTime.French,                      FuzzyTime.German,                      FuzzyTime.Greek,                      FuzzyTime.Italian,-                     FuzzyTime.French,+                     FuzzyTime.Japanese,                      FuzzyTime.Norwegian,                      FuzzyTime.Polish,                      FuzzyTime.Spanish,@@ -41,4 +42,4 @@ source-repository this     type:            git     location:        https://github.com/caminoix/fuzzytime-    tag:             0.7.5.1+    tag:             0.7.6
src/FuzzyTime.hs view
@@ -30,10 +30,11 @@ import FuzzyTime.Danish import FuzzyTime.Dutch import FuzzyTime.English+import FuzzyTime.French import FuzzyTime.German import FuzzyTime.Greek import FuzzyTime.Italian-import FuzzyTime.French+import FuzzyTime.Japanese import FuzzyTime.Norwegian import FuzzyTime.Polish import FuzzyTime.Spanish@@ -76,8 +77,9 @@ 		"el" -> showFuzzyTimeEl ft 		"en" -> showFuzzyTimeEn ft 		"es" -> showFuzzyTimeEs ft-		"it" -> showFuzzyTimeIt ft 		"fr" -> showFuzzyTimeFr ft+		"it" -> showFuzzyTimeIt ft+		"ja" -> showFuzzyTimeJa ft 		"nb" -> showFuzzyTimeNb ft 		"nl" -> showFuzzyTimeNl ft 		"pl" -> showFuzzyTimePl ft
+ src/FuzzyTime/Japanese.hs view
@@ -0,0 +1,73 @@+-- Japanese (petersen at fedoraproject.org) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------+++module FuzzyTime.Japanese (showFuzzyTimeJa) where++import {-# SOURCE #-} FuzzyTime+import Data.Char (toLower, toUpper)+import Data.List (intersperse)+import Prelude hiding (min)+++-- showFuzzyTimeJa ----------------------------------------------------------------------------------------------------------------------------------------------------------------+++showFuzzyTimeJa :: FuzzyTime -> String++-- FuzzyClock++showFuzzyTimeJa fc@(FuzzyClock am _ clock hour _ min style)+	| min == 0	= getHour hour ++ "時"+	| min < 45	= getHour hour ++ "時" ++ getMin min ++ ""+	| min >= 45	= getHour (nextFTHour fc) ++ "時" ++ getMin (60-min) ++ "前"+	| otherwise	= "あら、" ++ show hour ++ "時" ++ show min ++ "分です"+	where+	getHour :: Int -> String+	getHour h+		| h `elem` [0, 24]	= if style==1 then numeralJa clock else "零時"+		| h == 12		= if style==1 then numeralJa 12 else "正午"+		| otherwise		= numeralJa h+	getMin :: Int -> String+	getMin m+		| m == 30		= "半"+		| otherwise		= numeralJa m ++ "分"++-- FuzzyTimer++showFuzzyTimeJa (FuzzyTimer _ mins)+	| mins > 0	= "後 " ++ showHelper+	| mins == 0	= "今です!"+	| mins < 0	= "! " ++ showHelper ++ "前!"+	where+	showHelper :: String+	showHelper+		| mm > 90	= numeralJa hours ++ "時間" ++ (if half then "半" else "")+		| mm == 90	= "一時間半"+		| mm == 75	= "一時間十五分"+		| mm == 60	= "一時間"+		| mm == 45	= "四十五分"+		| mm == 30	= "三十分"+		| mm == 15	= "十五分"+		| mm >= 1	= numeralJa mm ++ "分"+		| otherwise	= "あら、残り " ++ show mins ++ "分"+	hours :: Int+	hours = round $ (fromIntegral mm :: Float) / 60+	mm :: Int+	mm = abs mins+	half :: Bool+	half = mm `mod` 60 == 30+++-- numeralJa ----------------------------------------------------------------------------------------------------------------------------------------------------------------------+++numeralJa :: Int -> String+numeralJa n+	| n < 20			= numeralJaHelper1 n+	| n `mod` 10 == 0	= numeralJaHelper10 (n `div` 10)+	| otherwise			= numeralJaHelper10 (n `div` 10) ++ numeralJaHelper1 (n `mod` 10)+	where+	numeralJaHelper1 :: Int -> String+	numeralJaHelper1 i = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九"] !! (i-1)+	numeralJaHelper10 :: Int -> String+	numeralJaHelper10 i = ["二十", "三十", "四十", "五十"] !! (i-2)
src/fuzzytime.1 view
@@ -1,4 +1,4 @@-.TH fuzzytime 1 "November 29, 2011" "version 0.7.5.1" "A fuzzy clock and timer"+.TH fuzzytime 1 "December 30, 2011" "version 0.7.6" "A fuzzy clock and timer"  .\" ------------------------------------------------------------------------------------- @@ -46,7 +46,7 @@ 12 or 24-hour clock (22:00 -> "ten" or "twenty-two"); the default is 12. Does not affect timer. .TP \-l \--lang-Language; currently Danish (da), Dutch (nl), English (en), French (fr), German (de), Greek (el), Norwegian (nb), Polish (pl), Spanish (es), Swedish (se) and Turkish (tr); the default is en. Affects timer.+Language; currently Danish (da), Dutch (nl), English (en), French (fr), German (de), Greek (el), Japanese (ja), Norwegian (nb), Polish (pl), Spanish (es), Swedish (se) and Turkish (tr); the default is en. Affects timer. .TP \-p \--prec Precision; should be between 1 and 60 [minutes]; the default is 5. Does not affect timer.@@ -301,6 +301,8 @@ .SH AUTHOR Kamil Stachowski (kamil.stachowski@gmail.com) +Japanese by Jens Petersen (petersen at fedoraproject.org)+ The crow sound has been recorded by PsychoBird and uploaded to http://soundbible.com/1486-Black-Crows-Cawing.html under the rules of the Attribtion 3.0 license [downloaded by KS 2011.01.23]  .SS Thanks@@ -324,6 +326,8 @@ ichbinsisyphos from forums.gentoo.org for German.  itsbrad212 from bbs.archlinux.org for Spanish.++Jens Petersen for adding Japanese.  litemotiv from bbs.archlinux.org for Dutch. 
src/fuzzytime.hs view
@@ -58,7 +58,7 @@  -- | \[config] Languages available. confAvailLangs :: [String]-confAvailLangs = ["da", "de", "el", "en", "es", "fr", "it", "nb", "nl", "pl", "se", "tr"]+confAvailLangs = ["da", "de", "el", "en", "es", "fr", "it", "ja", "nb", "nl", "pl", "se", "tr"]   -- defaults -----------------------------------------------------------------------------------------------------------------------------------------------------------------------@@ -183,7 +183,7 @@  -- | \[config] Help message for summary confHelpSummary :: String-confHelpSummary = "A clock and timer that tell the time in a more human way.\nv0.7.5.1, 2011.11.29, kamil.stachowski@gmail.com, GPL3+"+confHelpSummary = "A clock and timer that tell the time in a more human way.\nv0.7.6, 2011.12.30, kamil.stachowski@gmail.com, GPL3+"   -- check --------------------------------------------------------------------------------------------------------------------------------------------------------------------------