home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / xpgetstr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.9 KB  |  98 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef _XPGETSTR_H_
  20. #define _XPGETSTR_H_
  21. #include "prtypes.h"
  22.  
  23. XP_BEGIN_PROTOS
  24.  
  25. /**@name Platform Independent String Resources */
  26. /*@{*/
  27. /**
  28.  * Get a cross platform string resource by ID.
  29.  *
  30.  * This function makes localization easier for cross platform strings.
  31.  * The cross platfrom string resources are defined in allxpstr.h.
  32.  * You should use XP_GetString when:
  33.  * <OL>
  34.  * <LI>Any human readable string that not in front-end
  35.  * <LI>With the exception of HTML strings (use XP_GetStringForHTML)
  36.  * <LI>The translator/localizer will then translate the string defined
  37.  * in allxpstr.h and show the translated version to user.
  38.  * </OL>
  39.  * The caller should make a copy of the returned string if it needs to use
  40.  * it for a while. The same memory buffer will be used to store 
  41.  * another string the next time this function is called. The caller 
  42.  * does not need to free the memory of the returned string.
  43.  * @param id    Specifies the string resource ID
  44.  * @return        Localized (translated) string 
  45.  * @see XP_GetStringForHTML
  46.  * @see INTL_ResourceCharSet
  47.  */
  48. PUBLIC char *XP_GetString(int id);
  49.  
  50. /**
  51.  * Get a cross platform HTML string resource by ID.
  52.  *
  53.  * This function makes localization easier for cross platform strings used
  54.  * for generating HTML.  The cross platfrom string resources are defined in
  55.  * allxpstr.h.  You should use XP_GetStringForHTML when:
  56.  * <OL>
  57.  * <LI>Human readable string not defined in front-end
  58.  * <LI>The code generates HTML page and will go into HTML window
  59.  * <LI>Only use this when the message will be generated into HTML.
  60.  * <LI>Only use this if you can access to the winCharSetID.
  61.  * <LI>This is needed because half of the text is generated from resource
  62.  * (in resource charset) and half of the text is coming from the net
  63.  * (in winCharSetID charset). When we meet this kind of mixing charset 
  64.  * condition. We use this function instead of XP_GetString().
  65.  * </OL>
  66.  *
  67.  * The code checks the current CharSetID in the resource and the
  68.  * CharSetID of the data from the net.  If they are equal, it returns the
  69.  * string defined in the resource, otherwise, it will return the English
  70.  * version. So a French client can display French if the data from the
  71.  * net is in the CharSetID of French and it will use half English and half 
  72.  * Japanese if the French client receives Japanese data from the net.
  73.  *
  74.  * The caller should make a copy of the returned string if it needs to use
  75.  * it for a while. The same memory buffer will be used to store 
  76.  * another string the next time this function get called. The caller 
  77.  * does not need to free the memory of the returned string.
  78.  *  
  79.  * @param id            Specifies the string resource ID
  80.  * @param winCharSetID    Specifies the winCharSetID of the HTML 
  81.  * @param english        Specifies the English string
  82.  * @return                Localized (translated) string if the winCharSetID
  83.  *                        matches the CharSetID of the resource. Otherwise it
  84.  *                        returns the English message or the English string 
  85.  * @see XP_GetStringForHTML
  86.  * @see INTL_ResourceCharSet
  87.  */
  88. PUBLIC char *XP_GetStringForHTML(
  89.     int id, 
  90.     int16 winCharSetID, 
  91.     char* english
  92. );
  93. /*@}*/
  94.  
  95. XP_END_PROTOS
  96.  
  97. #endif
  98.