Lasso Soft Inc. > Home

[jina_dayName]

Linkjina_dayName
AuthorJolle Carlestam
CategoryDate
Version8.5.x
LicensePublic Domain
Posted05 Jul 2007
Updated17 Dec 2008
More by this author...

Description

This tag is now deprecated. Use date_int instead.
Returns the full day name for a given date. Supported languages are: Danish, Dutch, English, Finnish, French, German, Irish Gaelic, Italian, Norwegian, Portuguese, Spanish, Swedish, Greek (new), Chinese (new). Day names are capitalised in the format that's the language standard. For English Tuesday is returned as Tuesday, for Swedish it's returned as tisdag. Returned format can be modified using the optional -case. Supported cases are 'word|sentence|lower|upper'.

Sample Usage

	var:'thisday' = (jina_dayName: date, -language = 'sv');

	To change case from the language standard use -case:
	var:'thisday' = (jina_dayName: date, -language = 'sv', -case = 'word|sentence|lower|upper');

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

DayofWeek
					Now uses Select }

	{maintvsrn = 		1.3 }
	{maintrelease = 		1.0.0 }
	{maintdate = 		2004 01 09 }
	{maintauthor = 		Jolle Carlestam }
	{maintnotes = 		Tag now use namespaces for on-demand loading. }

	{maintvsrn = 		1.2 }
	{maintrelease = 		1.0.0 }
	{maintdate = 		2002-06-01 }
	{maintauthor = 		Jolle Carlestam }
	{maintnotes = 		initial release }

............................................................................

	Usage:

	var:'thisday' = (jina_dayName: date, -language = 'se');

	To change case from the language standard use -case:
	var:'thisday' = (jina_dayName: date, -language = 'se', -case = 'word|sentence|lower|upper');

.............................................................................

*/
define_tag: 'dayName',
	-namespace = 'jina_',
	-req = 'date', -type = 'date', -copy,
	-opt = 'language', -type = 'string',
	-opt = 'case', -type = 'string',
	-priority = 'replace',
	-description = 'Outputs a given dates day name in chosen language.'
;

	!local_defined('language') ? local('language' = 'en');
	!local_defined('case') ? local('case' = 'ignore');

// If a user supplies older and incorrect country codes change them to the correct value
	#language == 'se' ? #language = 'sv';
	#language == 'dk' ? #language = 'da';
	#language == 'ie' ? #language = 'ga';

	if(!(array('da', 'de', 'en', 'el', 'es', 'fi', 'fr', 'ga', 'it', 'nl', 'no', 'pt', 'sv', 'zh') >> #language));
		Fail: 8010, 'Unsupported language: ' + #language;
	/if;

	local:'DayofWeek' = #date->DayofWeek;

	select: #language;
		case: 'sv'; // Swedish
			local: 'DaysofTheWeek' = (map: 1 = 'söndag', 2 = 'måndag', 3 = 'tisdag', 4 = 'onsdag', 5 = 'torsdag', 6 = 'fredag', 7 = 'lördag');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'de'; // German
			local: 'DaysofTheWeek' = (map: 1 = 'Sonntag', 2 = 'Montag', 3 = 'Dienstag', 4 = 'Mittwoch', 5 = 'Donnerstag', 6 = 'Freitag', 7 = 'Samstag');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'fr'; // French
			local: 'DaysofTheWeek' = (map: 1 = 'dimanche', 2 = 'lundi', 3 = 'mardi', 4 = 'mercredi', 5 = 'jeudi', 6 = 'vendredi', 7 = 'samedi');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'it'; // Italian
			local: 'DaysofTheWeek' = (map: 1 = 'domenica', 2 = 'lunedì', 3 = 'martedì', 4 = 'mercoledì', 5 = 'giovedì', 6 = 'venerdì', 7 = 'sabato');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'es'; // Spanish
			local: 'DaysofTheWeek' = (map: 1 = 'domingo', 2 = 'lunes', 3 = 'martes', 4 = 'miércoles', 5 = 'jueves', 6 = 'viernes', 7 = 'sábado');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'nl'; // Dutch
			local: 'DaysofTheWeek' = (map: 1 = 'Zondag', 2 = 'Maandag', 3 = 'Dinsdag', 4 = 'Woensdag', 5 = 'Donderdag', 6 = 'Vrijdag', 7 = 'Zaterdag');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'ga'; // Irish Gaelic
			local: 'DaysofTheWeek' = (map: 1 = 'Dé Domhnaigh', 2 = 'Dé Luain', 3 = 'Dé Máirt', 4 = 'Dé Céadaoin', 5 = 'Déardaoin', 6 = 'Dé hAoine', 7 = 'Dé Sathairn');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'fi'; // Finnish
			local: 'DaysofTheWeek' = (map: 1 = 'sunnuntai', 2 = 'maanantai', 3 = 'tiistai', 4 = 'keskiviikko', 5 = 'torstai', 6 = 'perjantai', 7 = 'lauantai');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'no'; // Norwegian
			local: 'DaysofTheWeek' = (map: 1 = 'søndag', 2 = 'mandag', 3 = 'tirsdag', 4 = 'onsdag', 5 = 'torsdag', 6 = 'fredag', 7 = 'lørdag');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'da'; // Danish
			local: 'DaysofTheWeek' = (map: 1 = 'søndag', 2 = 'mandag', 3 = 'tirsdag', 4 = 'onsdag', 5 = 'torsdag', 6 = 'fredag', 7 = 'lørdag');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'pt'; // Portuguese
			local: 'DaysofTheWeek' = (map: 1 = 'domingo', 2 = 'segunda feira', 3 = 'terça feira', 4 = 'quarta feira', 5 = 'quinta feira', 6 = 'sexta feira', 7 = 'sábado');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'el'; // Greek
			local: 'DaysofTheWeek' = (map: 1 = '', 2 = '', 3 = '', 4 = '', 5 = '', 6 = '', 7 = '');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);
		case: 'zh'; // Chinese
			local: 'DaysofTheWeek' = (map: 1 = '', 2 = '', 3 = '', 4 = '', 5 = '', 6 = '', 7 = '');
			local:'dayName' = #DaysofTheWeek->(Find: #DayofWeek);

		case; // Can only be English
			local:'dayName' = #date->DayofWeek: -long;
	/select;

	select: #case;
		case: 'word'; // All words start with a capital: Tuesday | Dé Domhnaigh
			#dayName -> titleCase;
		case: 'sentence'; // First word start with a capital: Tuesday | Dé domhnaigh
			#dayName -> lowerCase;
			#dayName -> (ToTitle:1);
		case: 'lower'; // All words in lower case: tuesday | dé domhnaigh
			#dayName -> lowerCase;
		case: 'upper'; // All words in upper case: TUESDAY | DÉ DOMHNAIGH
			#dayName -> upperCase;
	/select;

	return:#dayName;
/define_tag;
	
?>

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft