Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file gettextModules.ml
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586(**************************************************************************)(* ocaml-gettext: a library to translate messages *)(* *)(* Copyright (C) 2003-2008 Sylvain Le Gall <sylvain@le-gall.net> *)(* *)(* This library is free software; you can redistribute it and/or *)(* modify it under the terms of the GNU Lesser General Public *)(* License as published by the Free Software Foundation; either *)(* version 2.1 of the License, or (at your option) any later version; *)(* with the OCaml static compilation exception. *)(* *)(* This library is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *)(* Lesser General Public License for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public *)(* License along with this library; if not, write to the Free Software *)(* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *)(* USA *)(**************************************************************************)(**
@author Sylvain Le Gall
*)openGettextTypesopenGettextCategory(** Function for manipulation the type t *)letupgrade_textdomaintkvalue=letcurrent_codeset,current_dir=tryMapTextdomain.findkt.textdomainswithNot_found->(None,None)inletnew_value=matchvaluewith|None,None->(current_codeset,current_dir)|None,new_dir->(current_codeset,new_dir)|new_codeset,None->(new_codeset,current_dir)|new_codeset,new_dir->(new_codeset,new_dir)in{twithtextdomains=MapTextdomain.addknew_valuet.textdomains}letcreate?(failsafe=Ignore)?(categories=[])?(codesets=[])?(dirs=[])?(textdomains=[])?(codeset=GettextConfig.default_codeset)?(path=GettextConfig.default_path)?languagetextdomain=letmap_categories=List.fold_left(funmap(category,locale)->MapCategory.addcategorylocalemap)MapCategory.emptycategoriesinletresult={failsafe;textdomains=MapTextdomain.empty;categories=map_categories;language;codeset;path;default=textdomain;}in(* Apply any upgrade required by the different settings provided *)letapply_upgradetlst=List.fold_left(funt(textdomain,changes)->upgrade_textdomainttextdomainchanges)tlstin(* All changes from the setting of textdomains *)lettextdomains_changes=List.map(funtextdomain->(textdomain,(None,None)))(textdomain::textdomains)in(* All changes from the setting of codesets *)letcodesets_changes=List.map(fun(textdomain,codeset)->(textdomain,(Somecodeset,None)))codesetsin(* All changes from the setting of dirs *)letdirs_changes=List.map(fun(textdomain,dir)->(textdomain,(None,Somedir)))dirsinapply_upgraderesult(textdomains_changes@codesets_changes@dirs_changes)