ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] How to Define a New Language
@ 2024-05-24 12:05 ai2472206007
  2024-05-24 12:25 ` [NTG-context] " ai2472206007
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: ai2472206007 @ 2024-05-24 12:05 UTC (permalink / raw)
  To: ntg-context

Hello, everyone. 

As the title describes, I want to define a new language: Chinese Traditional. 
Based on what I could find on the Internet, I made these settings. 
But I couldn't get the results I wanted.

%%%start example 
\usetypescriptfile[osx]
\setupbodyfont   [stfangsong]
\unprotect
\installlanguage[cnt] [default=cn,patterns=cn,factor=yes]
\setuplanguage  [cnt] [spacing=packed,default=cn,patterns=cn,factor=yes]
\setuplabeltext [cnt] [appendix={附錄}]
\protect
\mainlanguage[cnt]
\currentmainlanguage
\labeltext{appendix}
%%% stopexample

I think I'm going to get the two kanji [附錄]. But the truth is, he has nothing. 
But when I converted to Chinese Simplified, he magically appeared. 

%%%start example 
\usetypescriptfile[osx]
\setupbodyfont   [stfangsong]
\unprotect
\setuplabeltext [cn] [appendix={附錄}] %%% here switch to Chinese-Simplified
\protect
\currentmainlanguage
\labeltext{appendix}
%%% stopexample

So, what should I do to get it. Of course, my original assumption was that 
when I changed the language, these labels, fonts, indentations, line spacing, etc., 
would change. But for now, I'm stuck at defining a new language.

 If anyone can give advice, appreciate it

Muyik
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [NTG-context] Re: How to Define a New Language
  2024-05-24 12:05 [NTG-context] How to Define a New Language ai2472206007
@ 2024-05-24 12:25 ` ai2472206007
  2024-05-24 12:27 ` Jean-Pierre Delange
  2024-05-24 13:39 ` Wolfgang Schuster
  2 siblings, 0 replies; 8+ messages in thread
From: ai2472206007 @ 2024-05-24 12:25 UTC (permalink / raw)
  To: ntg-context

and ,I've found that along with the language, there is also a 'mode', 
and when I define a new language, does I also define such a new mode, like 'startmode[*en]stopmode'?
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [NTG-context] Re: How to Define a New Language
  2024-05-24 12:05 [NTG-context] How to Define a New Language ai2472206007
  2024-05-24 12:25 ` [NTG-context] " ai2472206007
@ 2024-05-24 12:27 ` Jean-Pierre Delange
  2024-05-24 14:34   ` ai2472206007
  2024-05-24 13:39 ` Wolfgang Schuster
  2 siblings, 1 reply; 8+ messages in thread
From: Jean-Pierre Delange @ 2024-05-24 12:27 UTC (permalink / raw)
  To: ntg-context

Hi Muyik !

The first thing to check, even if it seems stupid, is to make sure that 
the Traditional Chinese fonts are installed in the 
/context/context-mf/fonts/ etc. folder and test this installation with 
the following command:
mtxrun --script fonts --list --pattern="Chinese Font" --all (indicate 
actual font name)

Don't forget the following commands to purge the font cache and restore 
the database:

1. mtxrun --script cache --erase && mtxrun --generate

2. mtxrun --script fonts --reload
Then : 3. mtxrun --script fonts --list --pattern="Chinese Font" --all

Normally, the system should support the desired font after these checks. 
For my part, I have no problem with Traditional Chinese or Simplified 
Chinese fonts, but I haven't checked with OSX ...

I hope these few suggestions will help.

JP

Le 24/05/2024 à 14:05, ai2472206007@yeah.net a écrit :
> Hello, everyone.
>
> As the title describes, I want to define a new language: Chinese Traditional.
> Based on what I could find on the Internet, I made these settings.
> But I couldn't get the results I wanted.
>
> %%%start example
> \usetypescriptfile[osx]
> \setupbodyfont   [stfangsong]
> \unprotect
> \installlanguage[cnt] [default=cn,patterns=cn,factor=yes]
> \setuplanguage  [cnt] [spacing=packed,default=cn,patterns=cn,factor=yes]
> \setuplabeltext [cnt] [appendix={附錄}]
> \protect
> \mainlanguage[cnt]
> \currentmainlanguage
> \labeltext{appendix}
> %%% stopexample
>
> I think I'm going to get the two kanji [附錄]. But the truth is, he has nothing.
> But when I converted to Chinese Simplified, he magically appeared.
>
> %%%start example
> \usetypescriptfile[osx]
> \setupbodyfont   [stfangsong]
> \unprotect
> \setuplabeltext [cn] [appendix={附錄}] %%% here switch to Chinese-Simplified
> \protect
> \currentmainlanguage
> \labeltext{appendix}
> %%% stopexample
>
> So, what should I do to get it. Of course, my original assumption was that
> when I changed the language, these labels, fonts, indentations, line spacing, etc.,
> would change. But for now, I'm stuck at defining a new language.
>
>   If anyone can give advice, appreciate it
>
> Muyik
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [NTG-context] Re: How to Define a New Language
  2024-05-24 12:05 [NTG-context] How to Define a New Language ai2472206007
  2024-05-24 12:25 ` [NTG-context] " ai2472206007
  2024-05-24 12:27 ` Jean-Pierre Delange
@ 2024-05-24 13:39 ` Wolfgang Schuster
  2024-05-24 14:39   ` ai2472206007
  2 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2024-05-24 13:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users, ai2472206007

ai2472206007@yeah.net schrieb am 24.05.2024 um 14:05:
> Hello, everyone.
>
> As the title describes, I want to define a new language: Chinese Traditional.
> Based on what I could find on the Internet, I made these settings.
> But I couldn't get the results I wanted.
>
> %%%start example
> \usetypescriptfile[osx]
> \setupbodyfont   [stfangsong]
> \unprotect
> \installlanguage[cnt] [default=cn,patterns=cn,factor=yes]
> \setuplanguage  [cnt] [spacing=packed,default=cn,patterns=cn,factor=yes]
> \setuplabeltext [cnt] [appendix={附錄}]
> \protect
> \mainlanguage[cnt]
> \currentmainlanguage
> \labeltext{appendix}
> %%% stopexample
>
> I think I'm going to get the two kanji [附錄]. But the truth is, he has nothing.
> But when I converted to Chinese Simplified, he magically appeared.
>
> %%%start example
> \usetypescriptfile[osx]
> \setupbodyfont   [stfangsong]
> \unprotect
> \setuplabeltext [cn] [appendix={附錄}] %%% here switch to Chinese-Simplified
> \protect
> \currentmainlanguage
> \labeltext{appendix}
> %%% stopexample
>
> So, what should I do to get it. Of course, my original assumption was that
> when I changed the language, these labels, fonts, indentations, line spacing, etc.,
> would change. But for now, I'm stuck at defining a new language.
>
>   If anyone can give advice, appreciate it

1. It is better to add new languages to Context itself and not just in 
your document.

2. Chinese doesn't use hyphenation pattern but has rules where to break 
which is enabled with the \setscript command.

3. We should use agree upon a name which is used for traditional and 
simplified chinese (at the moment we have only chinese without 
distinction). Is it even enough to just separate between both or do we 
need separate setting china, singapore, taiwan, hong kong and macau?

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [NTG-context] Re: How to Define a New Language
  2024-05-24 12:27 ` Jean-Pierre Delange
@ 2024-05-24 14:34   ` ai2472206007
  0 siblings, 0 replies; 8+ messages in thread
From: ai2472206007 @ 2024-05-24 14:34 UTC (permalink / raw)
  To: ntg-context

Thanks for the reply, the part about fonts is no problem on my system.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [NTG-context] Re: How to Define a New Language
  2024-05-24 13:39 ` Wolfgang Schuster
@ 2024-05-24 14:39   ` ai2472206007
  2024-05-24 15:22     ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: ai2472206007 @ 2024-05-24 14:39 UTC (permalink / raw)
  To: ntg-context

3. In general, it is enough to distinguish between Chinese Simplified Chinese and Chinese Traditional.

Chinese has a large number of Chinese characters, therefore the fonts produced are generally divided into Chinese Simplified and Chinese Traditional. This causes Chinese Simplified Chinese fonts to fail to display Chinese Traditional. 

In addition to the differences in fonts, Chinese mainland, Taiwan(china), Hong Kong(china), etc. use different punctuation marks, expressions, etc. For example, Chinese mainland mainly uses "", while Taiwan may use 「」 more often. and the difference between the two Chinese expressions, such as when using labeltext.

While it's great to set up new languages at the system level, there is always the possibility that new languages will be added for one reason or another. 

As far as Chinese is concerned, it has a very large number of dialects. We can't be fully integrated into the system. Opening up suitable interfaces to add new languages can reduce the cost of system maintenance. 

As far as I know, the characters used (Chinese Simplified, Chinese Traditional), the punctuation marks used (Chinese mainland, Taiwan, Hong Kong), and the expressions used (Chinese mainland, Taiwan, Hong Kong) are basically different between the dialects of Chinese. There is no hyphenation difference in any dialect. 

As far as I am currently using, the context is not very well set for localization, and there are many words in lang-txt.lua that have not been translated into Chinese. I think that as an ordinary user, it is very dangerous to modify information at the system level.

Although, as a temporary alternative, we can use 'newif' or 'startmode' to add a new condition to accommodate both Chinese Simplified and Chinese Traditional in the same document. However, it would be nice to have support at the system level.

I don't know if I'm getting my point right. Because of the above, I used translation software to translate my thoughts.

Muyik
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [NTG-context] Re: How to Define a New Language
  2024-05-24 14:39   ` ai2472206007
@ 2024-05-24 15:22     ` Wolfgang Schuster
  2024-05-27 14:43       ` ai2472206007
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2024-05-24 15:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users, ai2472206007

ai2472206007@yeah.net schrieb am 24.05.2024 um 16:39:
> 3. In general, it is enough to distinguish between Chinese Simplified Chinese and Chinese Traditional.
> 
> Chinese has a large number of Chinese characters, therefore the fonts produced are generally divided into Chinese Simplified and Chinese Traditional. This causes Chinese Simplified Chinese fonts to fail to display Chinese Traditional.
> 
> In addition to the differences in fonts, Chinese mainland, Taiwan(china), Hong Kong(china), etc. use different punctuation marks, expressions, etc. For example, Chinese mainland mainly uses "", while Taiwan may use 「」 more often. and the difference between the two Chinese expressions, such as when using labeltext.

There are also differences regarding punctuation marks between official 
documents from the government and universities etc. but this is 
something which can be changed in the document style.

> While it's great to set up new languages at the system level, there is always the possibility that new languages will be added for one reason or another.
> 
> As far as Chinese is concerned, it has a very large number of dialects. We can't be fully integrated into the system. Opening up suitable interfaces to add new languages can reduce the cost of system maintenance.

The following should work with two main languages for simplified and 
traditional and local variant which fall back on both. The current 
chinese language can also be changed to the fallbacks.

\installlanguage [zh-hans] [..,..=..,..] % Simplified Chinese
\installlanguage [zh-hant] [..,..=..,..] % Traditional Chinese

\installlanguage [zh-cn] [zh-hans] % China
\installlanguage [zh-my] [zh-hans] % Malaysia
\installlanguage [zh-sg] [zh-hans] % Singapore

\installlanguage [zh-hk] [zh-hant] % Hong Kong
\installlanguage [zh-mo] [zh-hant] % Macau
\installlanguage [zh-tw] [zh-hant] % Taiwan

> As far as I know, the characters used (Chinese Simplified, Chinese Traditional), the punctuation marks used (Chinese mainland, Taiwan, Hong Kong), and the expressions used (Chinese mainland, Taiwan, Hong Kong) are basically different between the dialects of Chinese. There is no hyphenation difference in any dialect.

I looked at the rules for linebreaking in chinese a while ago and even 
though there are a few guidelines there is no fixed list this. Many 
programs let you change the characters where a break is or isn't possible.

> As far as I am currently using, the context is not very well set for localization, and there are many words in lang-txt.lua that have not been translated into Chinese. I think that as an ordinary user, it is very dangerous to modify information at the system level.

You're free to fill the missing entries.

> Although, as a temporary alternative, we can use 'newif' or 'startmode' to add a new condition to accommodate both Chinese Simplified and Chinese Traditional in the same document. However, it would be nice to have support at the system level.
> 
> I don't know if I'm getting my point right. Because of the above, I used translation software to translate my thoughts.

To support both forms it is easier to have separate languages and 
linebreaking/font settings for each of them.

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [NTG-context] Re: How to Define a New Language
  2024-05-24 15:22     ` Wolfgang Schuster
@ 2024-05-27 14:43       ` ai2472206007
  0 siblings, 0 replies; 8+ messages in thread
From: ai2472206007 @ 2024-05-27 14:43 UTC (permalink / raw)
  To: ntg-context

Thanks for your reply, I found out that I just deleted the code 'default=cn', and it actually worked.

With just this code system can install the language normally, and then get the correct 'labeltext'.

%%%
\installlanguage [zh-tw] [patterns=cn]% install traditional chinese
%%%
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-05-27 14:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24 12:05 [NTG-context] How to Define a New Language ai2472206007
2024-05-24 12:25 ` [NTG-context] " ai2472206007
2024-05-24 12:27 ` Jean-Pierre Delange
2024-05-24 14:34   ` ai2472206007
2024-05-24 13:39 ` Wolfgang Schuster
2024-05-24 14:39   ` ai2472206007
2024-05-24 15:22     ` Wolfgang Schuster
2024-05-27 14:43       ` ai2472206007

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).