Skip to content

Instantly share code, notes, and snippets.

@fsans
Last active February 7, 2021 10:37
Show Gist options
  • Save fsans/492179b945e946a3b8fc160d88ceb9a5 to your computer and use it in GitHub Desktop.
Save fsans/492179b945e946a3b8fc160d88ceb9a5 to your computer and use it in GitHub Desktop.
FileMaker CF

MonthNameLocale( fulldate; locale )

returns localized month name of "fulldate" to "locale" or system locale if param is empty)

Let ( 
[
	_month = Month (fulldate);
	_es = List("Enero";"Febrero";"Marzo";"Abril";"Mayo";"Junio";"Julio";"Agosto";"Septiembre";"Octubre";"Noviembre";"Diciembre");
	_ca = List("Gener";"Febrer";"Març";"Abril";"Maig";"Juny";"Juliol";"Agost";"Setembre";"Octubre";"Novembre";"Desembre");

	_error = Case(
				isEmpty(fulldate); "Date required";
				not isEmpty(locale) and (locale  "es" and locale  "ca"); "Not supported locale";
				"");
	
	_source = Case(locale="ca";_ca; locale="es";_es; "")
];

	Case( 
		_error; 			_error;
		isEmpty(_source); 	MonthName(_month);
		getValue(_source; 	_month)
	)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment