Ejemplo n.º 1
0
int
SetCatalog(char *localeName, char *catName)
{
    int r = -1;

    struct TagItem tags[3] = {
	OC_Language, localeName,
	OC_BuiltInLanguage, "none",
	TAG_DONE, NULL
    };
    if (localeName == NULL)
	tags[0].ti_Tag = TAG_IGNORE;

    ILocaleExit();
    if (LocaleBase) {
	if (Catalog = OpenCatalogA(NULL, catName, tags)) {
	    long *al;

	    r = 0;

	    for (al = _AutoLocale + 1; *al; al += 2) {
		/* printf("%s ->", (char *)*al); */
		printf("GetCat: %d %08lx\n", al[1], GetCatalogStr(Catalog, al[1], NULL));
		*al = GetCatalogStr(Catalog, al[1], (char *)al[0]);
		/* printf("%s\n", (char *)*al); */
	    }
	}
    }
    return(r);
}
Ejemplo n.º 2
0
/*** Localise all strings of the program ***/
void InitLocale(void)
{
	if( (catalog = (APTR) OpenCatalogA(NULL, "System/Tools/Editor.catalog", NULL)) )
	{
		WORD n;
		/* Translate menu strings */
		{	register struct NewMenu * nm;
			register STRPTR           str;
			extern   struct NewMenu   newmenu[];

			for(nm = newmenu, n = MSG_PROJECTTITLE; nm->nm_Type != NM_END; nm++)
			{
				if (nm->nm_Label != NM_BARLABEL)
				{
					str = (STRPTR) GetCatalogStr( catalog, n++, nm->nm_Label );
					/* Change shortcut to user prefered one */
					if (*str == 127) {
						nm->nm_CommKey  = str+1; str += 2;
						nm->nm_Flags   &= ~NM_COMMANDSTRING;
					}
					nm->nm_Label = str;
				}
			}
		}
		/* Translate all other messages */
		{	register STRPTR * str;
			for(n = 0, str = JanoMessages; n < sizeof(JanoMessages)/sizeof(STRPTR); n++, str++)
				if (*str != NULL)
					*str = (STRPTR) GetCatalogStr( catalog, n + ERR_BADOS, *str );
		}
	}
}
Ejemplo n.º 3
0
STRPTR GetString(LONG stringNum)
{
LONG   *l;
UWORD  *w;
STRPTR	builtIn;

    l = (LONG *)CatCompBlock;

    while (*l != stringNum)
    {
	w = (UWORD *)((ULONG)l + 4);
	l = (LONG *)((ULONG)l + (ULONG)*w + 6);
    }
    builtIn = (STRPTR)((ULONG)l + 6);

    printf("Catalog %08lx\n", Catalog);

    printf("GetString: %d %08lx\n", stringNum, GetCatalogStr(Catalog, stringNum, NULL));
    printf("GetString: %d %s\n", 1, GetCatalogStr(Catalog, 1, NULL));
    printf("GetString: %d %08lx\n", 0, GetCatalogStr(Catalog, 0, NULL));
    printf("GetString: %d %08lx\n", 2, GetCatalogStr(Catalog, 2, NULL));

    if (LocaleBase)
	return(GetCatalogStr(Catalog,stringNum,builtIn));

    return(builtIn);
}
Ejemplo n.º 4
0
int lib_locale_f_GetCatalogStr_2(emumsg_syscall_t *msg)
{
	/* Make real syscall */
	/* Explicit cast to STRPTR to remove AROS const warning */
	msg->arg[0]._strptr = (STRPTR)GetCatalogStr((struct Catalog *)msg->arg[0]._aptr,msg->arg[1]._long,msg->arg[2]._strptr);

	return HOOK_DONE;
}
Ejemplo n.º 5
0
/* Main *********************************************************************/
CONST_STRPTR _(ULONG id)
{
    if (LocaleBase != NULL && catalog != NULL)
    {
        return GetCatalogStr(catalog, id, CatCompArray[id].cca_Str);
    } else {
        return CatCompArray[id].cca_Str;
    }
}
Ejemplo n.º 6
0
STRPTR GetTrashmanString(APTR fcstr)
{ STRPTR defaultstr;
  LONG strnum;

  strnum = ((struct FC_Type *) fcstr)->ID;
  defaultstr = ((struct FC_Type *) fcstr)->Str;

  return(Trashman_Catalog ? GetCatalogStr(Trashman_Catalog, strnum, defaultstr) :
		      defaultstr);
}
Ejemplo n.º 7
0
STRPTR GetString(APTR fcstr, struct Catalog *catalog)
{
  STRPTR defaultstr;
  LONG strnum;

  strnum = ((struct FC_Type *) fcstr)->ID;
  defaultstr = ((struct FC_Type *) fcstr)->Str;

  return(catalog ? GetCatalogStr(catalog, strnum, defaultstr) :
		      defaultstr);
}
Ejemplo n.º 8
0
STRPTR GetString(LONG id, struct Catalog *catalog, struct AslBase_intern *AslBase)
{
    STRPTR retval = CatCompArray[id].cca_Str;
 
    if (catalog && LocaleBase)
    {
    	retval = (STRPTR)GetCatalogStr(catalog, id, retval);
    }
    
    return retval;
}
Ejemplo n.º 9
0
/* Main *********************************************************************/
CONST_STRPTR _(ULONG id, struct MiamiPanelBase_intern *MiamiPanelBaseIntern)
{
    if (LocaleBase != NULL && MiamiPanelBaseIntern->mpb_cat != NULL)
    {
	return GetCatalogStr(MiamiPanelBaseIntern->mpb_cat, id, CatCompArray[id].cca_Str);
    } 
    else 
    {
	return CatCompArray[id].cca_Str;
    }
}
Ejemplo n.º 10
0
/*** Locale Functions *******************************************************/
CONST_STRPTR MSG(struct Catalog *catalog, ULONG id)
{
    if (catalog != NULL)
    {
        return GetCatalogStr(catalog, id, CatCompArray[id].cca_Str);
    } 
    else 
    {
        return CatCompArray[id].cca_Str;
    }
}
Ejemplo n.º 11
0
CONST_STRPTR MSG(ULONG id)
{
    CONST_STRPTR retval;
    
    if (catalog)
    {
	retval = GetCatalogStr(catalog, id, CatCompArray[id].cca_Str);
    } else {
	retval = CatCompArray[id].cca_Str;
    }
    
    return retval;
}