<commit_before>/****************************************************************************
*   PROJECT: Squeak port for Win32
*   FILE:    sqWin32LocalePlugin.c
*   CONTENT: locale support
*
*   AUTHORS: <NAME> (ar) , <NAME> (be)
*   ADDRESS: Magdeburg, Germany
*   EMAIL:   <EMAIL>, <EMAIL>
*****************************************************************************/

#include <windows.h>
#include <winnls.h>
#include "sq.h"
#include "LocalePlugin.h"


/* Locale support functions */


sqInt sqLocInitialize(void) {

	return true;
}

/************** Country and language ******************/

/* write the country code into the string ptr. ISO 3166 is the relevant source
 * here; see http://www.unicode.org/onlinedat/countries.html for details.
 * Using the 3 character Alpha-3 codes */
void	sqLocGetCountryInto(char * str) {

/*	GEOID geoID;
	char *isoString;
	geoID = GetUserGeoID(GEOCLASS_NATION);
	GetGeoInfo (geoID, GEO_ISO3, *isoString, 3,0 );
	strncpy(str, isoString, 3);*/
}

/* write the 3 char string describing the language in use into string ptr.
 * ISO 639 is the relevant source here;
 * see http://www.w3.org/WAI/ER/IG/ert/iso639.html
 * for details */
void	sqLocGetLanguageInto(char * str) {

/*	GEOID geoID;
	char *isoString;
	geoID = GetUserGeoID(GEOCLASS_NATION);
	GetGeoInfo (geoId, GEO_LCID, *isoString, 3,0 );
	strncpy(str, isoString, 3);*/
}

/***************** Currency ********************/

/* return 1 (true) if the currency symbol is to be placed in front of the
 *currency amount */
sqInt	sqLocCurrencyNotation(void) {
	char currString[6];
	int r;
	if (GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_ICURRENCY,currString, 6) != 0){
		r =(((int) currString % 2) == 0);
		return r;
	}
	return 0;
}

/* return the length in chars of the curency symbol string */
sqInt	sqLocCurrencySymbolSize(void) {
	char currString[6];
	GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SCURRENCY,currString, 6);
}

/* write the currency symbol into the string ptr */
void	sqLocGetCurrencySymbolInto(char * str) {
	char currString[6];
	int length;
	length = GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SCURRENCY,currString, 6);
	strncpy(str, currString, length);<commit_msg>Win32: sqWin32Locale.c changed, functions for current country and language added, but return values are 2 character codes<commit_after>/****************************************************************************
*   PROJECT: Squeak port for Win32
*   FILE:    sqWin32LocalePlugin.c
*   CONTENT: locale support
*
*   AUTHORS: <NAME> (ar) , <NAME> (be)
*   ADDRESS: Magdeburg, Germany
*   EMAIL:   <EMAIL>, <EMAIL>
*****************************************************************************/

#include <windows.h>
#include <winnls.h>
#include "sq.h"
#include "LocalePlugin.h"


/* Locale support functions */


sqInt sqLocInitialize(void) {

	return true;
}

/************** Country and language ******************/

/* write the country code into the string ptr. ISO 3166 is the relevant source
 * here; see http://www.unicode.org/onlinedat/countries.html for details.
 * Using the 3 character Alpha-3 codes */
void	sqLocGetCountryInto(char * str) {

	char currString[6];
	int length;
	length = GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SISO3166CTRYNAME,currString, 6);
	strncpy(str, currString, length);

}

/* write the 3 char string describing the language in use into string ptr.
 * ISO 639 is the relevant source here;
 * see http://www.w3.org/WAI/ER/IG/ert/iso639.html
 * for details */
void	sqLocGetLanguageInto(char * str) {

	char currString[6];
	int length;
	length = GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SISO639LANGNAME,currString, 6);
	strncpy(str, currString, length);
}

/***************** Currency ********************/

/* return 1 (true) if the currency symbol is to be placed in front of the
 *currency amount */
sqInt	sqLocCurrencyNotation(void) {
	char currString[6];
	int r;
	if (GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_ICURRENCY,currString, 6) != 0){
		r =(((int) currString % 2) == 0);
		return r;
	}
	return 0;
}

/* return the length in chars of the curency symbol string */
sqInt	sqLocCurrencySymbolSize(void) {
	char currString[6];
	GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SCURRENCY,currString, 6);
}

/* write the currency symbol into the string ptr */
void	sqLocGetCurrencySymbolInto(char * str) {
	char currString[6];
	int length;
	length = GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SCURRENCY,currString, 6);
	strncpy(str, currString, length);
{'fraction_non_alphanumeric': 0.20440251572327045, 'fraction_numerical': 0.018194070080862535, 'mean_word_length': 5.142068965517241, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2239392', 'n_tokens_mistral': 1537, 'n_tokens_neox': 1466, 'n_words': 401}