From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mD3uNvHOk2BNJgEAgWs5BA (envelope-from ) for ; Thu, 06 May 2021 13:11:45 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id YFGjMvHOk2BUZQAAB5/wlQ (envelope-from ) for ; Thu, 06 May 2021 11:11:45 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3458F1C212 for ; Thu, 6 May 2021 13:11:45 +0200 (CEST) Received: from localhost ([::1]:54958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lebux-00074A-TF for larch@yhetil.org; Thu, 06 May 2021 07:11:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lebua-00073a-KG for emacs-orgmode@gnu.org; Thu, 06 May 2021 07:11:20 -0400 Received: from mout02.posteo.de ([185.67.36.66]:49287) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lebuX-0003sw-Tu for emacs-orgmode@gnu.org; Thu, 06 May 2021 07:11:20 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id E05352400FE for ; Thu, 6 May 2021 13:11:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1620299473; bh=Kb+KAjHGk8UyelY2KbISMLa8F1AFSLOeS0/CqnIwkao=; h=From:To:Cc:Subject:Date:From; b=PAOOclAvZPq1faU889rqkJ9O0Sjn6YTWq+AmrUr2Q1wKgk9IbfvDh/rX9KqtbUwMV osEItUde10XOvzFHYce6+sEjQq/prycAeZzYkXonsiD9fCQXn3soVK3VJzWLJT5xEs KvTEuXjxUKtucT5NcYPzvYthCRFe/vrSxsQNS43ORanu97pBBf3K7fDZlTwcAAx9ij YDWYKZnpTFDhfHvnzkwYqeg7BKX+oU8fF9fMtonTRxiK9w6BIWTPz7DnOf1y5hhqpO ebu9eM7iZHB+b35ZGd3KTXGsV4y9C0hU1WUn+3I0QmZ2SYd7kvJWjXI6YxAWnfaDdv gyIlhdhyW331A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FbW9D6VnXz9rxX; Thu, 6 May 2021 13:11:12 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Aleksandar Dimitrov Subject: Re: About multilingual documents References: <871raosx9a.fsf@posteo.net> <87k0og8fss.fsf@list.aleks.bg> <874kfjtv5u.fsf@posteo.net> <87bl9qvqf8.fsf@aleks.bg> Date: Thu, 06 May 2021 11:11:11 +0000 In-Reply-To: <87bl9qvqf8.fsf@aleks.bg> (Aleksandar Dimitrov's message of "Tue, 04 May 2021 10:44:43 +0200") Message-ID: <875yzwce28.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620299505; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=011VvG/Lb7+T8P6i4p4UkXEd5Ywx7exH1vKtUrtwN8s=; b=LN8IEa/v9+Ji6GBEeD0AZe8QV1F+/56GDOkgbcXplF2yfAsH2Bjhe7OE6CGB6YWzpmdFMV wTNNQDCk4C50wF47rn9iqgVXAX5q2x6yI/cb/zsaevCQhJflWEujDtPRxq1YFTkgv0g7ex pdSBy6/+ZZfBEof8g1A/sr1y8e0b62yEuoT9/FTiVI+NSKKg1YBx8Xccaay50pstz+lbcw Nrerhx+tTM1Z9ybuYqALjcLE9R+lfKKs1d3kSpbidj0jpZabzdNQLwxd/Srp61+22IuncD Bneje9YcqGWRHRXmzhMQyEKaaidYshTOi7uvxo8nlg5nFEeZeVbm2nt4MsXswQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620299505; a=rsa-sha256; cv=none; b=ql08rJ87JBYZeyOK/AE2cAGLeObKsCyTVj74/Pgf6wqYbaLap1rU/9PjIbiBjsug4GtNJF Ln8N6z+NL3HWrlCDMSoUbZWp2/SqaUyo9A1+6Rz8iOdvArg89iSWcHnSHmsBByGUnxpYNR oPvXYccJboLg3kr6s1j6U+LJffm4SfFeGVtWfEYmtSgA1EYfbCU7JA4XuIxMWdl5oI6/6N IHjj/3j0MK1ZEba95Wqxf/GY1TsqXk0Dx3xlX6PVcO/TQ1n45WlcNSUExGOiDOy5KCkRuD 87Dun5LQz4qYy/PFg54yIJJ0pQyV1jgcBRcG0YhY3IhXcwk/QERvNwe4XxWXNw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=PAOOclAv; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.66 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=PAOOclAv; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 3458F1C212 X-Spam-Score: -1.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: o8zrHesFWglZ --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Aleksandar, Aleksandar Dimitrov writes: > [...] > I must admit that I find the inline org-src notation (of which I > didn't know yet) somewhat jarring, and certainly less pleasant to > read. Perhaps we could use a similar mechanism to > =3Dorg-hide-emphasis-markers=3D to make it more pleasant to read. [1] You may be interested in this thread: https://orgmode.org/list/87a6r6avgg.f= sf@gmail.com/ > I definitely agree that Org would benefit from more multilingual > support. I'm not very experienced in emacs-lisp but would love to contrib= ute. > > One problem I foresee is the translation of locales into LaTeX macros > for either (LaTeX)-Babel or Polyglossia (which is what I use.) So a > string like "en" or "en_UK" (which is readily understood by > ([ai]|hun)spell) would have to be translated to the necessary > macros. For example for Polyglossia [2] the preamble would read > > \setdefaultlanguage[variant=3Duk]{english} > > And then the inline commands would have to be rendered as > \textenglish{=E2=80=A6} or \textlang{english}{=E2=80=A6} (probably the la= tter would be easier.) Since these days I had some free time, I have written this little snippet, based on your idea. Of course, it is only a 'sketch', or a 'proof of concept'. It has obvious limitations and does not collect all the features that your idea suggests. Here I only apply the (LaTeX) Babel environments, but they can be easily substituted by those of Polyglossia [1], or add both possibilities using a defcustom. I have put two options: `:lang' and `:lang-quotes'. The second option is to use it with the csquotes package. As I have only focused on exporting to LaTeX I have not included support for html (or odt), but I agree with you that it would be necessary to add some multilingual support as well for these backends. And there's no support for inline blocks either, as the output of the variables I've added is multiline. Anyway, it is a very hasty sketch (maybe too hasty ;-)), but if you want to try it, I attach here a small test document. The code: #+begin_src emacs-lisp (defun my-lang-org-backend (lang body) (cond ((org-export-derived-backend-p org-export-current-backend 'latex) (format "@@latex:\\begin{otherlanguage}{%s}@@\n%s\n@@latex:\\end{othe= rlanguage}@@" lang body)) ((or (org-export-derived-backend-p org-export-current-backend 'html) (org-export-derived-backend-p org-export-current-backend 'odt)) (format "%s" body)))) (defun my-lang-csquotes-org-backend (lang body) (cond ((org-export-derived-backend-p org-export-current-backend 'latex) (format "@@latex:\\begin{otherlanguage*}{%s}\n\\EnableQuotes@@\n%s\n@= @latex:\\end{otherlanguage*}@@" lang body)) ((or (org-export-derived-backend-p org-export-current-backend 'html) (org-export-derived-backend-p org-export-current-backend 'odt)) (format "%s" body)))) (defun org-babel-execute:org (body params) "Execute a block of Org code with. This function is called by `org-babel-execute-src-block'." (let ((result-params (split-string (or (cdr (assq :results params)) "")= )) (lang (cdr (assq :lang params))) (lang-quotes (cdr (assq :lang-quotes params))) (body (org-babel-expand-body:org (replace-regexp-in-string "^," "" body) params))) (cond (lang (my-lang-org-backend lang body)) (lang-quotes (my-lang-csquotes-org-backend lang-quotes body)) ((member "latex" result-params) (org-export-string-as (concat "#+Title: \n" body) 'latex t)) ((member "html" result-params) (org-export-string-as body 'html t)) ((member "ascii" result-params) (org-export-string-as body 'ascii t)) (t body)))) #+end_src Best regards, Juan Manuel [1] I used Polyglossia for a while, when I migrated to XeTeX and then to LuaTeX, and babel at that time did not support both engines. But now Babel does give them full support and has grown so much that it has surpassed (IMHO) to Polyglossia. I recommend taking a look at all novelties and new functionalities that has added the current Babel maintainer, Javier Bezos: http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf --=-=-= Content-Type: application/vnd.lotus-organizer Content-Disposition: attachment; filename=langs-test.org Content-Transfer-Encoding: base64 IyAtKi0gb3JnLWNvbmZpcm0tYmFiZWwtZXZhbHVhdGU6IG5pbDsgLSotCgojK09QVElPTlM6IHRv YzpuaWwKIytOQU1FOnByZWFtYmxlCiMrYmVnaW5fc3JjIGxhdGV4IDpleHBvcnRzIG5vbmUKICBc ZG9jdW1lbnRjbGFzc3thcnRpY2xlfQoKICBcdXNlcGFja2FnZXtmb250c3BlY30KCiAgXHVzZXBh Y2thZ2VbZ2VybWFuLHNwYW5pc2gsZnJlbmNoLGVuZ2xpc2hde2JhYmVsfQoKICBcYmFiZWxmb250 W117cm19W117TGludXggTGliZXJ0aW5lIE99CgogIFx1c2VwYWNrYWdlW2JhYmVsPXRydWUsYXV0 b3N0eWxlPXRydWUsZnJlbmNoPXF1b3RlcyxnZXJtYW49cXVvdGVzLHNwYW5pc2g9c3BhbmlzaF17 Y3NxdW90ZXN9CgogIFxNYWtlT3V0ZXJRdW90ZXsifQoKICBccGFyc2tpcD0xZW1ccGFyaW5kZW50 PTFlbQojK2VuZF9zcmMKCiMrYmVnaW5fc3JjIGxhdGV4IDpub3dlYiB5ZXMgOnJlc3VsdHMgcmF3 CiwjK0xhVGVYX0hlYWRlcjogPDxwcmVhbWJsZT4+CiMrZW5kX3NyYwoKKiBUZXN0cwoKIytiZWdp bl9zcmMgb3JnIDpyZXN1bHRzIHJlcGxhY2UgOmV4cG9ydHMgcmVzdWx0cyA6bGFuZyBmcmVuY2gK ICAsIytiZWdpbl9xdW90ZQogIE5vdXMgZXhhZ8Opcm9ucyBsZSBtYWxoZXVyIGV0IGxlIGJvbmhl dXIgZGUgbWFuacOocmUgw6lnYWxlLCBub3VzIG5lIHNvb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