*** empty log message ***
[m17n/m17n-lib.git] / src / language.c
index b214db9..32dd9e0 100644 (file)
@@ -94,7 +94,6 @@ init_script_list (void)
 int
 mlang__init ()
 {
-  Mlanguage = msymbol ("language");
   msymbol_put (Mlanguage, Mtext_prop_serializer,
               (void *) msymbol__serializer);
   msymbol_put (Mlanguage, Mtext_prop_deserializer,
@@ -109,8 +108,6 @@ mlang__init ()
 void
 mlang__fini (void)
 {
-  MPlist *plist, *p;
-
   M17N_OBJECT_UNREF (language_list);
   language_list = NULL;
   M17N_OBJECT_UNREF (script_list);
@@ -125,7 +122,7 @@ mlang__fini (void)
     The mlanguage_info () function returns a well-formed @e plist that
     contains information about $LANGUAGE.  $LANGUAGE is a symbol whose
     name is an ISO639-2 3-letter language code, an ISO639-1 2-letter
-    language codes, or an English name.
+    language codes, or an English word.
 
     The format of the plist is:
 
@@ -209,6 +206,8 @@ mscript__char_list (MSymbol name)
 
   if (plist                    /* script name */
       && (plist = MPLIST_NEXT (plist)) /* language list */
+      && ! MPLIST_TAIL_P (plist)
+      && (plist = MPLIST_NEXT (plist)) /* char list */
       && MPLIST_PLIST_P (plist))
     return MPLIST_PLIST (plist);
   return NULL;
@@ -280,9 +279,9 @@ MSymbol Miso639_1, Miso639_2;
 /***en
     @brief List 3-letter language codes.
 
-    The mlanguage_list () funciton returns a well-formed plist
-    whose keys are #Msymbol and values are symbols whose names
-    are ISO639-2 3-letter language codes.
+    The mlanguage_list () funciton returns a well-formed plist whose
+    keys are #Msymbol and values are symbols whose names are ISO639-2
+    3-letter language codes.
 
     @return
     This function returns a plist.  The caller should free it by
@@ -291,6 +290,20 @@ MSymbol Miso639_1, Miso639_2;
     @seealso
     mscript_list ().  */
 
+/***ja
+    @brief 3\e$BJ8;z8@8l%3!<%I$r%j%9%H$9$k\e(B.
+
+    \e$B4X?t\e(B mlanguage_list () \e$B$O!"@07A<0\e(B (well-formed) plist \e$B$rJV$9!#3F%-!<\e(B
+    \e$B$O\e(B #Msymbol \e$B$G$"$j!"8D!9$NCM$O\e(B ISO639-2 \e$B$KDj$a$i$l$?\e(B3\e$BJ8;z8@8l%3!<\e(B
+    \e$B%I$rL>A0$H$9$k%7%s%\%k$G$"$k!#\e(B
+
+    @return
+    \e$B$3$N4X?t$,JV$9\e(B plist \e$B$O!"8F$S=P$7B&$,\e(B m17n_object_unref () \e$B$r;H$C\e(B
+    \e$B$F2rJ|$9$kI,MW$,$"$k!#\e(B
+
+    @seealso
+    mscript_list ().  */
+
 MPlist *
 mlanguage_list (void)
 {
@@ -313,15 +326,16 @@ mlanguage_list (void)
 /***en
     @brief Get a language code.
 
-    The mlanguage_code () function returns a symbol whose name is an
+    The mlanguage_code () function returns a symbol whose name is the
     ISO639 language code of $LANGUAGE. $LANGUAGE is a symbol whose
     name is an ISO639-2 3-letter language code, an ISO639-1 2-letter
-    language codes, or an English name.
+    language codes, or an English word.
 
-    $LEN specifies which type of language code to return.  If it is 3,
-    ISO639-2 3-letter language code is returned.  If it is 2, ISO639-1
-    2-letter language code (if available) or #Mnil is returned.  If it
-    is 0, 2-letter code (if available) or 3-letter code is returned.
+    $LEN specifies the type of the returned language code.  If it is
+    3, an ISO639-2 3-letter language code is returned.  If it is 2, an
+    ISO639-1 2-letter language code is returned when defined;
+    otherwise #Mnil is returned.  If it is 0, a 2-letter code is
+    returned when defined; otherwise a 3-letter code is returned.
 
     @return
     If the information is available, this function returns a non-#Mnil
@@ -330,6 +344,27 @@ mlanguage_list (void)
     @seealso
     mlanguage_name (), mlanguage_text ().  */
 
+/***ja
+    @brief \e$B8@8l%3!<%I$rF@$k\e(B.
+
+    \e$B4X?t\e(B mlanguage_code () \e$B$O!"\e(B$LANGUAGE \e$B$KBP1~$7$?\e(B ISO-639 \e$B8@8l%3!<%I\e(B
+    \e$B$,L>A0$G$"$k$h$&$J%7%s%\%k$rJV$9!#\e(B$LANGUAGE \e$B$O%7%s%\%k$G$"$j!"$=$N\e(B
+    \e$BL>A0$O!"\e(BISO639-2 3\e$BJ8;z8@8l%3!<%I!"\e(BISO639-1 2\e$BJ8;z8@8l%3!<%I!"1Q8lL>!"\e(B
+    \e$B$N$$$:$l$+$G$"$k!#\e(B
+
+    $LEN \e$B$OJV$5$l$k8@8l%3!<%I$N<oN`$r7hDj$9$k!#\e(B$LEN \e$B$,\e(B3\e$B$N>l9g$O\e(B 
+    ISO639-2 3\e$BJ8;z8@8l%3!<%I$,JV$5$l$k!#\e(B2\e$B$N>l9g$O!"$b$7Dj5A$5$l$F$$$l\e(B
+    \e$B$P\e(B ISO639-1 2\e$BJ8;z8@8l%3!<%I$,!"$=$&$G$J$1$l$P\e(B #Mnil \e$B$,JV$5$l$k!#\e(B0 
+    \e$B$N>l9g$O!"$b$7Dj5A$5$l$F$$$l$P\e(B2\e$BJ8;z%3!<%I$,!"$=$&$G$J$1$l$P\e(B3\e$BJ8;z%3!<\e(B
+    \e$B%I$,JV$5$l$k!#\e(B
+
+    @return
+    \e$B$b$7>pJs$,F@$i$l$l$P!"$3$N4X?t$O\e(B #Mnil \e$B0J30$N%7%s%\%k$rJV$9!#$=$&\e(B
+    \e$B$G$J$1$l$P\e(B #Mnil \e$B$rJV$9!#\e(B
+
+    @seealso
+    mlanguage_name (), mlanguage_text ().  */
+
 MSymbol
 mlanguage_code (MSymbol language, int len)
 {
@@ -337,9 +372,9 @@ mlanguage_code (MSymbol language, int len)
   MSymbol code;
 
   if (! plist)
-    return NULL;
+    return Mnil;
   if (! MPLIST_SYMBOL_P (plist))
-    return NULL;
+    return Mnil;
   code = MPLIST_SYMBOL (plist);
   if (len == 3)
     return code;
@@ -355,7 +390,9 @@ mlanguage_code (MSymbol language, int len)
     @brief Get an English language name.
 
     The mlanguage_name () function returns a symbol whose name is an
-    English name of $LANGUAGE.
+    English name of $LANGUAGE.  $LANGUAGE is a symbol whose name is an
+    ISO639-2 3-letter language code, an ISO639-1 2-letter language
+    codes, or an English word.
 
     @return
     If the information is available, this function returns a non-#Mnil
@@ -364,6 +401,20 @@ mlanguage_code (MSymbol language, int len)
     @seealso
     mlanguage_code (), mlanguage_text ().  */
 
+/***ja
+    @brief \e$B8@8l$N1Q8lL>$rF@$k\e(B.
+
+    \e$B4X?t\e(B mlanguage_name () \e$B$O!"\e(B$LANGUAGE \e$B$N1Q8lL>$rL>A0$H$9$k$h$&$J%7\e(B
+    \e$B%s%\%k$rJV$9!#\e(B$LANGUAGE \e$B$O%7%s%\%k$G$"$j!"$=$NL>A0$O!"\e(BISO639-2 3\e$BJ8\e(B
+    \e$B;z8@8l%3!<%I!"\e(BISO639-1 2\e$BJ8;z8@8l%3!<%I!"1Q8lL>!"$N$$$:$l$+$G$"$k!#\e(B
+
+    @return
+    \e$B5a$a$F$$$k>pJs$,F@$i$l$k$J$i!"$3$N4X?t$O\e(B #Mnil \e$B0J30$N%7%s%\%k$rJV\e(B
+    \e$B$9!#$=$&$G$J$1$l$P\e(B #Mnil \e$B$rJV$9!#\e(B
+
+    @seealso
+    mlanguage_code (), mlanguage_text ().  */
+
 MSymbol
 mlanguage_name (MSymbol language)
 {
@@ -383,17 +434,34 @@ mlanguage_name (MSymbol language)
 /*=*/
 
 /***en
-    @brief Return a language name written in the language.
+    @brief Return the language name written in that language.
 
-    The mlanguage_text () function returns by M-text a language name
-    of $LANGUAGE written $LANGUAGE.  If the representative characters
-    of the language is known, the first character of the returned
-    M-text has text-property #Mtext whose value is an M-text contains
-    the representative characters.
+    The mlanguage_text () function returns, in the form of M-text, the
+    language name of $LANGUAGE written in $LANGUAGE.  If the
+    representative characters of the language are known, the
+    characters of the returned M-text has a text property whose key is
+    #Mtext and whose value is an M-text that contains the
+    representative characters.
 
     @return
-    If the information available, this function returns an M-text that
-    should not modified nor freed.  Otherwise, it returns @c NULL.
+    If the information is available, this function returns an M-text
+    that should not be modified nor freed.  Otherwise, it returns @c
+    NULL.
+
+    @seealso
+    mlanguage_code (), mlanguage_name ().  */
+
+/***ja
+    @brief \e$BM?$($i$l$?8@8l<+?H$G=q$+$l$?8@8lL>$rJV$9\e(B.
+
+    \e$B4X?t\e(B mlanguage_text () \e$B$O!"8@8l\e(B $LANGUAGE \e$B$G=q$+$l$?\e(B $LANGUAGE \e$B$N\e(B
+    \e$BL>A0$r\e(B M-text \e$B$N7A<0$GJV$9!#$=$N8@8l$NBeI=E*$JJ8;z$,$o$+$C$F$$$k>l\e(B
+    \e$B9g$O!"JV$5$l$k\e(B M-text \e$B$N3FJ8;z$K!"%-!<$,\e(B #Mtext \e$B$GCM$,$=$NBeI=E*$J\e(B
+    \e$BJ8;z$r4^$`\e(B M-text \e$B$G$"$k$h$&$J%F%-%9%H%W%m%Q%F%#$,IU2C$5$l$k!#\e(B
+
+    @return
+    \e$B5a$a$k>pJs$,F@$i$l$?>l9g!"$3$N4X?t$,JV$9\e(B M-text \e$B$rJQ99$7$?$j2rJ|$7\e(B
+    \e$B$?$j$7$F$O$$$1$J$$!#>pJs$,F@$i$l$J$+$C$?>l9g$O\e(B @c NULL \e$B$,JV$5$l$k!#\e(B
 
     @seealso
     mlanguage_code (), mlanguage_name ().  */
@@ -433,12 +501,26 @@ mlanguage_text (MSymbol language)
     names.
 
     @return
-    This function returns plist.  The caller has to free it by
+    This function returns a plist.  The caller should free it by
     m17n_object_unref ().
 
     @seealso
     mscript_language_list (), mlanguage_list ().  */
 
+/***ja
+    @brief \e$B%9%/%j%W%HL>$r%j%9%H$9$k\e(B.
+
+    \e$B4X?t\e(B mscript_list () \e$B$O!"@07A<0\e(B (well-formed) plist \e$B$rJV$9!#3F%-!<\e(B
+    \e$B$O\e(B #Msymbol \e$B$G$"$j!"8D!9$NCM$O%9%/%j%W%HL>$rL>A0$H$9$k%7%s%\%k$G$"\e(B
+    \e$B$k!#\e(B
+
+    @return
+    \e$B$3$N4X?t$,JV$9\e(B plist \e$B$O!"8F$S=P$7B&$,\e(B m17n_object_unref () \e$B$r;H$C\e(B
+    \e$B$F2rJ|$9$kI,MW$,$"$k!#\e(B
+
+    @seealso
+    mscript_language_list (), mlanguage_list ().  */
+
 MPlist *
 mscript_list (void)
 {
@@ -461,18 +543,38 @@ mscript_list (void)
 /***en
     @brief List languages that use a specified script.
 
-    The mscript_language_list () function lists language names that
-    use $SCRIPT.
+    The mscript_language_list () function lists languages that use
+    $SCRIPT.  $SCRIPT is a symbol whose name is the lower-cased
+    version of a script name that appears in the Unicode Character
+    Database.
 
     @return
-    This function returns a well-formed @e plist whose keys are
-    #Msymbol and values are symbols representing language names
-    (ISO639-1 2-letter code (if defined) or ISO639-2 3-letter code).
-    The caller should not modify nor free it.  If the m17n library
-    doesn't know about $SCRIPT, it returns NULL.
+
+    This function returns a well-formed plist whose keys are #Msymbol
+    and values are symbols whose names are ISO639-1 2-letter codes (or
+    ISO639-2 3-letter codes, if the former is not available).  The
+    caller should not modify nor free it.  If the m17n library does
+    not know about $SCRIPT, it returns @ c NULL.
+
+    @seealso
+    mscript_list (), mlanguage_list ().  */
+
+/***ja
+    @brief \e$BM?$($i$l$?%9%/%j%W%H$rMQ$$$k8@8l$r%j%9%H$9$k\e(B.
+
+    \e$B4X?t\e(B mscript_language_list () \e$B$O!"\e(B$SCRIPT \e$B$rMQ$$$k8@8l$r%j%9%H$9$k!#\e(B
+    $SCRIPT \e$B$O%7%s%\%k$G!"$=$NL>A0$O\e(B Unicode Character Database \e$B$K<($5\e(B
+    \e$B$l$F$$$k%9%/%j%W%HL>$r$9$Y$F>.J8;z$K$7$?$b$N$G$"$k!#\e(B
+
+    @return \e$B$3$N4X?t$O!"@07A<0\e(B (well-formed) plist \e$B$rJV$9!#3F%-!<$O\e(B 
+    #Msymbol \e$B$G$"$j!"8D!9$NCM$O\e(B ISO639-1 \e$B$KDj$a$i$l$?\e(B2\e$BJ8;z8@8l%3!<%I\e(B
+    (\e$BDj5A$5$l$F$$$J$$>l9g$O\e(B ISO639-2 \e$B$KDj$a$i$l$?\e(B3\e$BJ8;z8@8l%3!<%I\e(B) \e$B$rL>\e(B
+    \e$BA0$H$9$k%7%s%\%k$G$"$k!#JV$5$l$k\e(B plist \e$B$OJQ99$7$?$j2rJ|$7$?$j$7$F\e(B
+    \e$B$O$J$i$J$$!#\e(B$SCRIPT \e$B$,L$CN$N>l9g$O\e(B @c NULL \e$B$,JV$5$l$k!#\e(B
 
     @seealso
     mscript_list (), mlanguage_list ().  */
+    
 
 MPlist *
 mscript_language_list (MSymbol script)