xgettext package:tools R Documentation _E_x_t_r_a_c_t _T_r_a_n_s_l_a_t_a_b_l_e _M_e_s_s_a_g_e_s _f_r_o_m _R _F_i_l_e_s _i_n _a _P_a_c_k_a_g_e _D_e_s_c_r_i_p_t_i_o_n: For each file in the 'R' directory (including system-specific subdirectories) of a package, extract the unique arguments passed to 'stop', 'warning', 'message', 'gettext' and 'gettextf', or to 'ngettext'. _U_s_a_g_e: xgettext(dir, verbose = FALSE, asCall = TRUE) xngettext(dir, verbose = FALSE) xgettext2pot(dir, potFile) _A_r_g_u_m_e_n_t_s: dir: the directory of a source package. verbose: logical: should each file be listed as it is processed? asCall: logical: if 'TRUE' each argument is returned whole, otherwise the strings within each argument are extracted. potFile: name of 'po' template file to be produced. Defaults to '"R-pkgname.pot"' where pkgname is the basename of 'dir'. _D_e_t_a_i_l_s: Leading and trailing white space (space, tab and linefeed) is removed for calls to 'gettext', 'gettextf', 'stop', 'warning', and 'message', as it is by the internal code that passes strings for translation. We look to see if these functions were called with 'domain = NA' and if so omit the call if 'asCall = TRUE': note that the call might contain a call to 'gettext' which would be visible if 'asCall = FALSE'. 'xgettext2pot' calls 'xgettext' and then 'xngettext', and writes a PO template file for use with the 'GNU Gettext' tools. This ensures that the strings for simple translation are unique in the file (as 'GNU Gettext' requires), but does not do so for 'ngettext' calls (and the rules are not stated in the Gettext manual). If applied to the 'base' package, this also looks in the '.R' files in 'R_HOME/share/R'. _V_a_l_u_e: For 'xgettext', a list of objects of class '"xgettext"' (which has a 'print' method), one per source file that potentially contains translatable strings. For 'xngettext', a list of objects of class '"xngettext"', which are themselves lists of length-2 character strings. _E_x_a_m_p_l_e_s: ## Not run: ## in a source-directory build of R: xgettext(file.path(R.home(), "src", "library", "splines")) ## End(Not run)