Say the Time in Spanish
$30-100 USD
Publicado hace casi 14 años
$30-100 USD
Pagado a la entrega
Write a Visual Basic function, that creates a sentence saying the time,? in Spanish.? The sentence should be in a form that would be suitable for "speaking" in a causal style to a friend who asked you "what time is it?"? ( It will be spoken by text-to-speech software, but you don't have to code anything for TTS speech.. just this one function below: (see the "Additional Info" field below.)
Also: Give advice and translations for how to code in Spanish, to extract the number of minutes from choices like "every 1 minute", every 2 minutes, every 10 minutes, every 1 hour, etc. (see complete list in Additional Info)
Required: Coder must be a native Spanish speaker.
## Deliverables
Here is an English version of the Function and Strings. Please use this as a template for the Spanish version.? No strings shall be hard coded into the algorithm.? All strings used shall be assigned into a Arrays of type String, for use by the algorithm.
'// Pass a parameter like "en-us". based on [[login to view URL](VS.85).aspx][1]
'// Returns a string having a phrase for the current time like "It's three twenty five P. M."
Public Function GetTimePhrase( ByVal theLanguage As String ) As String
? ? ? Dim theHour As Long? ? ? ? ? ? ? ? ? ? '// integer number from 0 to 23.
? ? ? Dim theMinute As Long? ? ? ? ? ? ? ? '// integer number from 0 to 59.
? ? ? Dim theSpokenTime As String? ? '// Build the final sentence in here.
? ? ? Dim thePiece As String? ? ? ? ? ? ? '// Smaller components of the phrase.
? ? ?
? ? ? '// Add whatever extra local variables that you need when internationalizaing.
? ? ?
? ? ? theHour = Hour(Now)? ? ? ? ? '// In VB6, returns integer values from 0 to 23.
? ? ? theMinute = Minute(Now)? '// integer values from 0 to 59.
? ? ?
? ? ? theSpokenTime = TimePiece(14)? ? ? ? '// TimePiece(14) = "Time language was not recognized."
? ? ? If theLanguage = "en-us" Then? ? '// this can be hard-coded. All other strings, not.
? ? ? ? ? ? ? '// start with empty pattern, later to Replace() its pieces.
? ? ? ? ? ? ? theSpokenTime = TimePiece(15)? ? '// TimePiece(15) = "<intro> <hour> <minute> <ampm>."
? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? '//? Using Replace() of patterns is preferred for internationalization.
? ? ? ? ? ? ? ? ? ? '//? Don't use string Concatenations.
? ? ? ? ? ? ?
? ? ? ? ? ? ? '// For English, speak with 12-hour am/pm format.? Feel free to change this code
? ? ? ? ? ? ? '// and comments for other languages.
? ? ? ? ? ? ?
? ? ? ? ? ? ? If theHour > 12 Then
? ? ? ? ? ? ? ? ? ? ? thePiece = TimePiece(8)? ? '// TimePiece(8) = "P. M."
? ? ? ? ? ? ? Elseif theHour = 12 And theMinute = 0 Then
? ? ? ? ? ? ? ? ? ? ? thePiece = TimePiece(6)? ? '// TimePiece(6) = "noon"
? ? ? ? ? ? ? Elseif theHour = 0? And theMinute = 0 Then
? ? ? ? ? ? ? ? ? ? ? thePiece = TimePiece(5)? ? // TimePiece(5) = "midnight"
? ? ? ? ? ? ? Else
? ? ? ? ? ? ? ? ? ? ? thePiece = TimePiece(7)? ? '// TimePiece(7) = "A. M."
? ? ? ? ? ? ? End If
? ? ? ? ? ? ? theSpokenTime = Replace( theSpokenTime, TimePiece(19), thePiece )? '// TimePiece(19) = "<ampm>"
? ? ? ? ? ? ? '// in English, we don't say "zero oclock" after midnight. we say "twelve oclock am"
? ? ? ? ? ? ? If theHour = 0 Then
? ? ? ? ? ? ? ? ? ? ? theHour = 12
? ? ? ? ? ? ? Elseif theHour > 12 Then? ? ? '// 13:00 becomes 1 oclock pm, etc.
? ? ? ? ? ? ? ? ? ? ? theHour = theHour - 12
? ? ? ? ? ? ? End If
? ? ? ? ? ? ? thePiece = HourWord( theHour + 1 )? '// eg. 13:00 becomes 1,? then add 1 = 2. HourWord(2) = "one"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '//? ? ? ? 23:00 becomes 11, then add 1 = 12. HourWord(12) = "eleven"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? theSpokenTime = Replace( theSpokenTime, TimePiece(17), thePiece )? ? '// TimePiece(17) = "<hour>"
? ? ? ? ? ? ? thePiece = MinuteWord( theMinute + 1 ) '// :00 becomes 1, so MinuteWord(1) = "o'clock"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '// :01 becomes 2, so MinuteWord(2) = "oh one"
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '// :59 becomes 60, so MinuteWord(60) = "fifty nine"
? ? ? ? ? ? ? theSpokenTime = Replace( theSpokenTime, TimePiece(18), thePiece )? ? '// TimePiece(18) = "<minute>"
? ? ? ? ? ? ? '// Lastly is the <intro>. To give some variety, I choose a random number.
? ? ? ? ? ? ? '//? You can use function RandNum( ByVal theMax as Long ) As Long
? ? ? ? ? ? ? '//? which returns a random integer between 1 and theMax.
? ? ? ? ? ? ? thePiece = IntroTime( RandNum( IntroTimeMax ) )
? ? ? ? ? ? ? theSpokenTime = Replace( theSpokenTime, TimePiece(16), thePiece )? '// TimePiece(16) = "<intro>"
? ? ? End If
? ? ?
? ? ? SayTime = theSpokenTime? '// Return the final result, here at the end. (not anywhere else)
? ? ?
End Function
Public MinuteWord(60) As String? '// Array to hold words used for each minute.
Public HourWord(24) As String? ? ? '// Array to hold words used for each hour.
Public TimePiece(20) As String? ? '// Various pieces of words or phrases used to build the sentence."
Public IntroTime(2) As String? ? ? '// For introductory statements, that can be randomly substituted for variety.
Public IntroTimeMax As Long? ? ? ? ? '// Number of different variations of the introductory phrase.
Public Sub AssignStrings
? ? ? '// Although there are more efficient ways, including letting
? ? ? '// the text-to-speech engine speak numbers, I want an algorithm
? ? ? '// that has access to ALL the words needed, for ANY time. built manually.
? ? ? MinuteWord(1) = "o'clock"? ? ? ? '// "o'clock"? ? Leave all these comments in English.
? ? ? MinuteWord(2) = "oh one"? ? ? ? ? '// "oh one"? ? ? but translate the string values into whatever language.
? ? ? MinuteWord(3) = "oh two"? ? ? ? ? '// "oh two"
? ? ? MinuteWord(4) = "oh three"? ? ? '// "oh three"
? ? ? MinuteWord(5) = "oh four"? ? ? ? '// "oh four"
? ? ? MinuteWord(6) = "oh five"? ? ? ? '// "oh five"
? ? ? MinuteWord(7) = "oh six"? ? ? ? ? '// "oh six"
? ? ? MinuteWord(8) = "oh seven"? ? ? '// "oh seven"
? ? ? MinuteWord(9) = "oh eight"? ? ? '// "oh eight"
? ? ? MinuteWord(10) = "oh nine"? ? ? '// "oh nine"
? ? ? MinuteWord(11) = "ten"? ? ? ? ? ? ? '// "ten"
? ? ? MinuteWord(12) = "eleven"? ? ? ? ? ? '// "eleven"
? ? ? MinuteWord(13) = "twelve"? ? ? ? ? ? '// "twelve"
? ? ? MinuteWord(14) = "thirteen"? ? ? ? '// "thirteen"
? ? ? MinuteWord(15) = "fourteen"? ? ? ? '// "fourteen"
? ? ? MinuteWord(16) = "fifteen"? ? ? ? ? '// "fifteen"
? ? ? MinuteWord(17) = "sixteen"? ? ? ? ? '// "sixteen"
? ? ? MinuteWord(18) = "seventeen"? ? ? '// "seventeen"
? ? ? MinuteWord(19) = "eighteen"? ? ? ? '// "eighteen"
? ? ? MinuteWord(20) = "nineteen"? ? ? ? '// "nineteen"
? ? ? MinuteWord(21) = "twenty"? ? ? ? ? ? ? ? ? ? ? '// "twenty"
? ? ? MinuteWord(22) = "twenty one"? ? ? ? ? ? ? '// "twenty one"
? ? ? MinuteWord(23) = "twenty two"? ? ? ? ? ? ? '// "twenty two"
? ? ? MinuteWord(24) = "twenty three"? ? ? ? ? '// "twenty three"
? ? ? MinuteWord(25) = "twenty four"? ? ? ? ? ? '// "twenty four"
? ? ? MinuteWord(26) = "twenty five"? ? ? ? ? ? '// "twenty five"
? ? ? MinuteWord(27) = "twenty six"? ? ? ? ? ? ? '// "twenty six"
? ? ? MinuteWord(28) = "twenty seven"? ? ? ? ? '// "twenty seven"
? ? ? MinuteWord(29) = "twenty eight"? ? ? ? ? '// "twenty eight"
? ? ? MinuteWord(30) = "twenty nine"? ? ? ? ? ? '// "twenty nine"
? ? ? MinuteWord(31) = "thirty"? ? ? ? ? ? ? ? ? '// "thirty"
? ? ? MinuteWord(32) = "thirty one"? ? ? ? ? '// "thirty one"
? ? ? MinuteWord(33) = "thirty two"? ? ? ? ? '// "thirty two"
? ? ? MinuteWord(34) = "thirty three"? ? ? '// "thirty three"
? ? ? MinuteWord(35) = "thirty four"? ? ? ? '// "thirty four"
? ? ? MinuteWord(36) = "thirty five"? ? ? ? '// "thirty five"
? ? ? MinuteWord(37) = "thirty six"? ? ? ? ? '// "thirty six"
? ? ? MinuteWord(38) = "thirty seven"? ? ? '// "thirty seven"
? ? ? MinuteWord(39) = "thirty eight"? ? ? '// "thirty eight"
? ? ? MinuteWord(40) = "thirty nine"? ? ? ? '// "thirty nine"
? ? ? MinuteWord(41) = "forty"? ? ? ? ? ? ? ? ? '// "forty"
? ? ? MinuteWord(42) = "forty one"? ? ? ? ? '// "forty one"
? ? ? MinuteWord(43) = "forty two"? ? ? ? ? '// "forty two"
? ? ? MinuteWord(44) = "forty three"? ? ? '// "forty three"
? ? ? MinuteWord(45) = "forty four"? ? ? ? '// "forty four"
? ? ? MinuteWord(46) = "forty five"? ? ? ? '// "forty five"
? ? ? MinuteWord(47) = "forty six"? ? ? ? ? '// "forty six"
? ? ? MinuteWord(48) = "forty seven"? ? ? '//? "forty seven"
? ? ? MinuteWord(49) = "forty eight"? ? ? '// "forty eight"
? ? ? MinuteWord(50) = "forty nine"? ? ? ? '// "forty nine"
? ? ? MinuteWord(51) = "fifty"? ? ? ? ? ? ? ? ? ? '// "fifty"
? ? ? MinuteWord(52) = "fifty one"? ? ? ? ? ? '// "fifty one"
? ? ? MinuteWord(53) = "fifty two"? ? ? ? ? ? '// "fifty two"
? ? ? MinuteWord(54) = "fifty three"? ? ? ? '// "fifty three"
? ? ? MinuteWord(55) = "fifty four"? ? ? ? ? '// "fifty four"
? ? ? MinuteWord(56) = "fifty five"? ? ? ? ? '// "fifty five"
? ? ? MinuteWord(57) = "fifty six"? ? ? ? ? ? '// "fifty six"
? ? ? MinuteWord(58) = "fifty seven"? ? ? ? '// "fifty seven"
? ? ? MinuteWord(59) = "fifty eight"? ? ? ? '// "fifty eight"
? ? ? MinuteWord(60) = "fifty nine"? ? ? ? ? '// "fifty nine"
? ? ? HourWord(1) = "oh"? ? ? ? ? ? ? '// "oh"? ? keep comments in English
? ? ? HourWord(2) = "one"? ? ? ? ? ? '// "one"
? ? ? HourWord(3) = "two"? ? ? ? ? ? '// "two"
? ? ? HourWord(4) = "three"? ? ? ? '// "three"
? ? ? HourWord(5) = "four"? ? ? ? ? '// "four"
? ? ? HourWord(6) = "five"? ? ? ? ? '// "five"
? ? ? HourWord(7) = "six"? ? ? ? ? ? '// "six"
? ? ? HourWord(8) = "seven"? ? ? ? '// "seven"
? ? ? HourWord(9) = "eight"? ? ? ? '// "eight"
? ? ? HourWord(10) = "nine"? ? ? ? '// "nine"
? ? ? HourWord(11) = "ten"? ? ? ? ? '// "ten"
? ? ? HourWord(12) = "eleven"? ? '// "eleven"
? ? ? HourWord(13) = "twelve"? ? '// "twelve"
? ? ? HourWord(14) = "one"? ? ? ? ? '// "one" for 13:00
? ? ? HourWord(15) = "two"? ? ? ? ? '// "two" for 14:00
? ? ? HourWord(16) = "three"? ? ? '// "three"
? ? ? HourWord(17) = "four"? ? ? ? '// "four"
? ? ? HourWord(18) = "five"? ? ? ? '// "five"
? ? ? HourWord(19) = "six"? ? ? ? ? '// "six"
? ? ? HourWord(20) = "seven"? ? ? '// "seven"
? ? ? HourWord(21) = "eight"? ? ? '// "eight"
? ? ? HourWord(22) = "nine"? ? ? ? '// "nine"
? ? ? HourWord(23) = "ten"? ? ? ? ? '// "ten"
? ? ? HourWord(24) = "eleven"? ? '// "eleven"
? ? ? TimePiece(1) = "o'clock"? ? ? ? ? ? ? ? '// "o'clock"? ? ? ? ? ?
? ? ? TimePiece(2) = "quarter past"? ? ? '// "quarter past"
? ? ? TimePiece(3) = "half past"? ? ? ? ? ? '// "half past"
? ? ? TimePiece(4) = "quarter to"? ? ? ? ? '// "quarter to"
? ? ? TimePiece(5) = "midnight"? ? ? ? ? ? ? '// "midnight"
? ? ? TimePiece(6) = "noon"? ? ? ? ? ? ? ? ? ? ? '// "noon"
? ? ? TimePiece(7) = "A. M."? ? ? ? ? ? ? ? ? ? '// "A. M." formatted for spoken.
? ? ? TimePiece(8) = "P. M."? ? ? ? ? ? ? ? ? ? '// "P. M."?
? ? ? TimePiece(9) = "evening"? ? ? ? ? ? ? ? '// "evening"? not usually needed in English
? ? ? TimePiece(10) = "hour"? ? ? ? ? ? ? ? ? ? '// "hour"? ? ? ? not usually needed in English
? ? ? TimePiece(11) = "hours"? ? ? ? ? ? ? ? ? '// "hours"? ? ? not usually needed in English
? ? ? TimePiece(12) = "minute"? ? ? ? ? ? ? ? '// "minute"? ? not usually needed in English
? ? ? TimePiece(13) = "minutes"? ? ? ? ? ? ? '// "minutes"? not usually needed in English
? ? ? TimePiece(14) = "Time language was not recognized."
? ? ? TimePiece(15) = "<intro> <hour> <minute> <ampm>."
? ? ? TimePiece(16) = "<intro>"
? ? ? TimePiece(17) = "<hour>"
? ? ? TimePiece(18) = "<minute>"
? ? ? TimePiece(19) = "<ampm>"
? ? ? TimePiece(20) = "(add additional pieces as needed)"
? ? ?
? ? ? IntroTime(1) = "It's"? ? ? ? ? ? ? ? ? ? ? '// Randomly chosen <intro> before saying the time.
? ? ? IntroTime(2) = "The time is"? ? ? ? '// If other languages have more variety, add them.
? ? ? IntroTimeMax = UBound(IntroTime)
? ? ?
? ? ?
? ? ?
End Sub
Job #2:? Translate these Strings into Spanish, into a form that means, the interval between Saying something
? ? ? RandomDelayStringArray(1) = "1 minute"
? ? ? RandomDelayStringArray(2) = "2 minutes"
? ? ? RandomDelayStringArray(3) = "3 minutes"
? ? ? RandomDelayStringArray(4) = "4 minutes"
? ? ? RandomDelayStringArray(5) = "5 minutes"
? ? ? RandomDelayStringArray(6) = "10 minutes"
? ? ? RandomDelayStringArray(7) = "20 minutes"
? ? ? RandomDelayStringArray(8) = "30 minutes"
? ? ? RandomDelayStringArray(9) = "1 hour"
? ? ? RandomDelayStringArray(10) = "2 hours"
? ? ? RandomDelayStringArray(11) = "3 hours"
? ? ? RandomDelayStringArray(12) = "4 hours"
? ? ? FreqArray(1) = "every 1 minute"
? ? ? FreqArray(2) = "every 2 minutes"
? ? ? FreqArray(3) = "every 5 minutes"
? ? ? FreqArray(4) = "every 10 minutes"
? ? ? FreqArray(5) = "every 15 minutes"
? ? ? FreqArray(6) = "every 20 minutes"
? ? ? FreqArray(7) = "every 30 minutes"
? ? ? FreqArray(8) = "every 45 minutes"
? ? ? FreqArray(9) = "every 60 minutes"
? ? ? FreqArray(10) = "every 90 minutes"
? ? ? FreqArray(11) = "every 2 hours"
? ? ? FreqArray(12) = "every 3 hours"
? ? ? FreqArray(13) = "every 4 hours"
? ? ? FreqArray(14) = "every 6 hours"
? ? ? FreqArray(15) = "every 8 hours"
? ? ? FreqArray(16) = "every 12 hours"
? ? ? FreqArray(17) = "every 24 hours"
ID del proyecto: 3508648
Información sobre el proyecto
2 propuestas
Proyecto remoto
Activo hace 14 años
¿Buscas ganar dinero?
Beneficios de presentar ofertas en Freelancer
Fija tu plazo y presupuesto
Es gratis registrarse y presentar ofertas en los trabajos
2 freelancers están ofertando un promedio de $43 USD por este trabajo
$42,50 USD en 2 días
4,5 (2 comentarios)