Skip to content

DOC-3147: Language code standardization to RFC5646/BCP47 format. #3771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions modules/ROOT/examples/live-demos/spellchecker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ tinymce.init({
plugins: 'code tinymcespellchecker link',
toolbar: 'spellchecker language spellcheckdialog',
height: 500,
spellchecker_language: 'en_US',
spellchecker_language: 'en-US',
content_langs: [
{ title: 'Afrikaans (South Africa)', code: 'af_ZA', customCode: 'af_ZA' },
{ title: 'English (Australia)', code: 'en_AU' },
{ title: 'English (Canada)', code: 'en_CA' },
{ title: 'English (United Kingdom)', code: 'en_GB' },
{ title: 'English (United States)', code: 'en_US' },
{ title: 'Medical English (US)', code: 'en_US', customCode: 'en_US-medical' },
{ title: 'Medical English (UK)', code: 'en_GB', customCode: 'en_GB-medical' },
{ title: 'Afrikaans (South Africa)', code: 'af-ZA', customCode: 'af-ZA' },
{ title: 'English (Australia)', code: 'en-AU' },
{ title: 'English (Canada)', code: 'en-CA' },
{ title: 'English (United Kingdom)', code: 'en-GB' },
{ title: 'English (United States)', code: 'en-US' },
{ title: 'Medical English (US)', code: 'en-US', customCode: 'en-US-medical' },
{ title: 'Medical English (UK)', code: 'en-GB', customCode: 'en-GB-medical' },
{ title: 'Danish', code: 'da' },
{ title: 'Dutch', code: 'nl_NL' },
{ title: 'Dutch', code: 'nl-NL' },
{ title: 'Finnish', code: 'fi' },
{ title: 'French', code: 'fr' },
{ title: 'German', code: 'de_DE' },
{ title: 'German', code: 'de-DE' },
{ title: 'Hungarian', code: 'hu' },
{ title: 'Italian', code: 'it_IT' },
{ title: 'Maori (New Zealand)', code: 'mi_NZ' },
{ title: 'Norwegian Bokmål', code: 'nb_NO' },
{ title: 'Italian', code: 'it-IT' },
{ title: 'Maori (New Zealand)', code: 'mi-NZ' },
{ title: 'Norwegian Bokmål', code: 'nb-NO' },
{ title: 'Norwegian Nynorsk', code: 'nn' },
{ title: 'Polish', code: 'pl' },
{ title: 'Portuguese (Brazil)', code: 'pt_BR' },
{ title: 'Portuguese (Portugal)', code: 'pt_PT' },
{ title: 'Portuguese (Brazil)', code: 'pt-BR' },
{ title: 'Portuguese (Portugal)', code: 'pt-PT' },
{ title: 'Spanish', code: 'es' },
{ title: 'Swedish', code: 'sv_SE' },
{ title: 'Swedish (Finland)', code: 'sv_FI' }
{ title: 'Swedish', code: 'sv-SE' },
{ title: 'Swedish (Finland)', code: 'sv-FI' }
],
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
});
61 changes: 61 additions & 0 deletions modules/ROOT/pages/8.0-release-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,67 @@ The following premium plugin updates were released alongside {productname} {rele

// For information on the **<Premium plugin name 1>** plugin, see: xref:<plugincode>.adoc[<Premium plugin name 1>].

=== Spell Checker

The {productname} {release-version} includes an accompanying release of the **Spell Checker** premium plugin.

**Spell Checker** includes the following improvement.

=== Language code standardization to RFC5646/BCP47 format

The {productname} {release-version} release introduces standardized support for language codes using the RFC5646 (also known as BCP47) format. This update applies to all language-related configurations, including:

* UI language packs (premium and community)
* Spellchecker language codes
* HTML `lang` attributes
* Content language selection

**Changes**

* Language codes now use hyphens (`-`) instead of underscores (`_`). For example:
** `'en-US'` instead of `'en_US'`
** `'zh-TW'` instead of `'zh_TW'`
** `'pt-BR'` instead of `'pt_BR'`
* Base language codes without regions (e.g., `'en'`, `'es'`, `'fr'`) remain unchanged.
* File names for language packs have been updated to use hyphens.
* Premium plugins have been updated to recognize RFC5646-compliant codes.

**Backward Compatibility**

To ensure a smooth migration

* Both hyphenated and underscore formats are supported in {productname} {release-version}.
* A console warning is displayed when the legacy underscore format is used.
* Both formats of language pack files are distributed with {productname} {release-version}.
* {productname} 9 will support only the RFC5646-compliant hyphenated format.

**Migration**

. Update language-related configuration in `tinymce.init`:
+
[source,javascript]
----
language: 'en-US',
spellchecker_language: 'en-US'
----
+
. Update `content_langs` configuration:
+
[source,javascript]
----
content_langs: [
{ title: 'English (US)', code: 'en-US' },
{ title: 'Portuguese (Brazil)', code: 'pt-BR' }
]
----
+
. Rename any custom dictionary files to use hyphens (e.g., `'en-GB.txt'` instead of `'en_GB.txt'`).
. Ensure any server-side integrations or custom language pack files follow the new naming convention.

This standardization aligns {productname} with modern web standards and improves consistency across its multilingual features.

For information on the **Spell Checker** premium plugin, see: xref:introduction-to-tiny-spellchecker.adoc[Spell Checker plugin] or for an complete list of supported languages, see: xref:introduction-to-tiny-spellchecker.adoc#supported-languages[Supported languages].

=== Accessibility Checker

The {productname} {release-version} release includes an accompanying release of the **Accessibility Checker** premium plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

One custom dictionary can be created for each language already supported by the spell checker (see xref:introduction-to-tiny-spellchecker.adoc#supported-languages[supported languages]) or any arbitrary language added by additional Hunspell dictionary files included in Hunspell Dictionary Path (See xref:self-hosting-hunspell.adoc[Add Hunspell dictionaries to Spell Checker]). It's also possible to define an additional "global" dictionary that contains words that are valid across all languages, such as trademarks.

A custom dictionary file for a particular language must be named with the language code of the language (see xref:introduction-to-tiny-spellchecker.adoc#supported-languages[supported languages] for language code examples), plus the suffix `+.txt+`: E.g. `+en.txt+`, `+en_gb.txt+`, `+fr.txt+`, `+de.txt+` etc.
A custom dictionary file for a particular language must be named with the language code of the language (see xref:introduction-to-tiny-spellchecker.adoc#supported-languages[supported languages] for language code examples), plus the suffix `+.txt+`: E.g. `+en.txt+`, `+en-GB.txt+`, `+fr.txt+`, `+de.txt+` etc.

The "global" dictionary file for language-independent words must be called "global.txt".

Expand Down
6 changes: 3 additions & 3 deletions modules/ROOT/pages/introduction-to-tiny-spellchecker.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ With {cloudname} the server-side spellchecking component is automatically config
tinymce.init({
selector: 'textarea',
plugins: 'tinymcespellchecker',
spellchecker_language: 'en_US'
spellchecker_language: 'en-US' // Note: Using RFC5646 format with hyphen
});
----

Expand All @@ -47,7 +47,7 @@ tinymce.init({
selector: 'textarea',
plugins: 'tinymcespellchecker',
spellchecker_rpc_url: 'localhost/ephox-spelling',
spellchecker_language: 'en_US'
spellchecker_language: 'en-US' // Note: Using RFC5646 format with hyphen
});
----

Expand Down Expand Up @@ -243,7 +243,7 @@ tinymce.init({

The `+spelling+` object, which is provided by the `+SpellcheckerUpdated+` event, contains the result of the spelling service spellcheck.

The keys of the outermost object are the language code for each checked language.
The keys of the outermost object are the language code for each checked language (using RFC5646 format, e.g., 'en-US', 'es-ES').

Under each returned language code is an object with

Expand Down
4 changes: 2 additions & 2 deletions modules/ROOT/pages/localize-your-language.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ IMPORTANT: The language settings will not work unless the language pack is place

== Step 3

Set the language option in {productname}'s configuration to the language code in the list on xref:ui-localization.adoc#language[this page].
Set the language option in {productname}'s configuration to the RFC5646 language code in the list on xref:ui-localization.adoc#language[this page].

== Step 4

Expand All @@ -46,7 +46,7 @@ link:{gettiny}/language-packages/[Download the Chinese language] pack to test th
<script type="text/javascript">
tinymce.init({
selector: 'textarea',
language: 'zh_CN',
language: 'zh-CN',
directionality: 'rtl'
});
</script>
Expand Down
6 changes: 3 additions & 3 deletions modules/ROOT/partials/configuration/language.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ For information on:

=== Example: using `+language+`

In this example we will set the editor language to Swedish.
In this example we will set the editor language to Swedish using the RFC5646 format:

[source,js]
----
tinymce.init({
selector: 'textarea', // change this value according to your HTML
language: 'sv_SE'
language: 'sv-SE'
});
----

[[using-the-premium-language-packs]]
=== Using the premium language packs

The following professionally localized language packs are provided to paid {cloudname} and premium self-hosted deployments. To use these language packs, set the `+language+` option to the corresponding language code. No additional configuration is required.
The following professionally localized language packs are provided to paid {cloudname} and premium self-hosted deployments. To use these language packs, set the `+language+` option to the corresponding language code in RFC5646 format. No additional configuration is required.

include::partial$misc/ui-languages.adoc[leveloffset=+2]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This option specifies the default language used by Spell Checker.

*Type:* `+String+`

*Default value:* `+'en_US'+`
*Default value:* `+'en-US'+`

=== Example: using `+spellchecker_language+`

Expand All @@ -14,6 +14,6 @@ This option specifies the default language used by Spell Checker.
tinymce.init({
selector: 'textarea',
plugins: 'tinymcespellchecker',
spellchecker_language: 'de'
spellchecker_language: 'de' // Use ISO language code, hyphenated for regional variants (e.g., 'de-DE')
});
----
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This option specifies the spellchecker languages that are available to the user,
*Default value:*
[source,js]
----
'English (United States)=en_US,English (United Kingdom)=en_GB,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Norwegian Bokmål=nb_NO,Norwegian Nynorsk=nn,Brazilian Portuguese=pt_BR,Portuguese=pt,Portuguese (Portugal)=pt_PT,Spanish=es,Swedish=sv,Swedish (Finland)=sv_FI,Afrikaans (South Africa)=af_ZA,English (Australia)=en_AU,English (Canada)=en_CA,English (United Kingdom)=en_GB,English (United States)=en_US,Medical English (US)=en_US-medical,Medical English (UK)=en_GB-medical,Maori (New Zealand)=mi_NZ'
'English (United States)=en-US,English (United Kingdom)=en-GB,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Norwegian Bokmål=nb-NO,Norwegian Nynorsk=nn,Brazilian Portuguese=pt-BR,Portuguese=pt,Portuguese (Portugal)=pt-PT,Spanish=es,Swedish=sv,Swedish (Finland)=sv-FI,Afrikaans (South Africa)=af-ZA,English (Australia)=en-AU,English (Canada)=en-CA,English (United Kingdom)=en-GB,English (United States)=en-US,Medical English (US)=en-US-medical,Medical English (UK)=en-GB-medical,Maori (New Zealand)=mi-NZ'
----


Expand All @@ -19,6 +19,6 @@ This option specifies the spellchecker languages that are available to the user,
tinymce.init({
selector: 'textarea',
plugins: 'tinymcespellchecker',
spellchecker_languages: 'US English=en_US,UK English=en_GB,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Norwegian Bokmål=nb_NO,Norwegian Nynorsk=nn,Brazilian Portuguese=pt_BR,Portuguese=pt,Portuguese (Portugal)=pt_PT,Spanish=es,Swedish=sv,Swedish (Finland)=sv_FI,Afrikaans (South Africa)=af_ZA,English (Australia)=en_AU,English (Canada)=en_CA,English (United Kingdom)=en_GB,English (United States)=en_US,Medical English (US)=en_US-medical,Medical English (UK)=en_GB-medical,Maori (New Zealand)=mi_NZ'
spellchecker_languages: 'US English=en-US,UK English=en-GB,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Norwegian Bokmål=nb-NO,Norwegian Nynorsk=nn,Brazilian Portuguese=pt-BR,Portuguese=pt,Portuguese (Portugal)=pt-PT,Spanish=es,Swedish=sv,Swedish (Finland)=sv-FI,Afrikaans (South Africa)=af-ZA,English (Australia)=en-AU,English (Canada)=en-CA,English (United Kingdom)=en-GB,English (United States)=en-US,Medical English (US)=en-US-medical,Medical English (UK)=en-GB-medical,Maori (New Zealand)=mi-NZ'
});
----
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ spelling-tiny-1 | 2025-02-11 09:51:11.104Z [io-compute-blocker-6] INFO c.e.i.d
spelling-tiny-1 | 2025-02-11 09:51:11.161Z [io-compute-blocker-6] INFO com.ephox.nectar.data.Bees$ - Loading all dictionaries from WinterTree
spelling-tiny-1 | 2025-02-11 09:51:11.482Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Loading hunspell dictionary from path: /app/resources/hunspell-dictionaries and locale es
spelling-tiny-1 | 2025-02-11 09:51:11.536Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Finished loading hunspell for es
spelling-tiny-1 | 2025-02-11 09:51:11.537Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Loading hunspell dictionary from path: /app/resources/hunspell-dictionaries and locale pt_BR
spelling-tiny-1 | 2025-02-11 09:51:11.881Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Finished loading hunspell for pt_BR
spelling-tiny-1 | 2025-02-11 09:51:11.537Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Loading hunspell dictionary from path: /app/resources/hunspell-dictionaries and locale pt-BR
spelling-tiny-1 | 2025-02-11 09:51:11.881Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Finished loading hunspell for pt-BR
...
spelling-tiny-1 | 2025-02-11 09:51:13.593Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Loading hunspell dictionary from path: /app/resources/hunspell-dictionaries and locale de_DE
spelling-tiny-1 | 2025-02-11 09:51:13.651Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Finished loading hunspell for de_DE
spelling-tiny-1 | 2025-02-11 09:51:13.593Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Loading hunspell dictionary from path: /app/resources/hunspell-dictionaries and locale de-DE
spelling-tiny-1 | 2025-02-11 09:51:13.651Z [io-compute-blocker-5] INFO c.e.nectar.hunspell.HunspellLoader$ - Finished loading hunspell for de-DE
spelling-tiny-1 | 2025-02-11 09:51:14.142Z [io-compute-9] INFO o.h.b.c.nio1.NIO1SocketServerGroup - Service bound to address /0:0:0:0:0:0:0:0:18080
spelling-tiny-1 | 2025-02-11 09:51:14.146Z [io-compute-9] INFO o.h.blaze.server.BlazeServerBuilder -
spelling-tiny-1 | _ _ _ _ _
Expand Down Expand Up @@ -215,7 +215,7 @@ To confirm that a request is being sent to the {pluginname} service, use:
+
[source, sh]
----
curl http://localhost:18080/2/check -d '{"words": ["teh"], "language": "en_US"}' -H "Origin: http://good.com" -H "Content-Type: application/json"
curl http://localhost:18080/2/check -d '{"words": ["teh"], "language": "en-US"}' -H "Origin: http://good.com" -H "Content-Type: application/json"
----

+
Expand All @@ -224,7 +224,7 @@ Finally, to verify if a request is unauthorized and originates from an incorrect
+
[source, sh]
----
curl http://localhost:18080/2/check -d '{"words": ["teh"], "language": "en_US"}' -H "Origin: http://bad.com" -H "Content-Type: application/json"
curl http://localhost:18080/2/check -d '{"words": ["teh"], "language": "en-US"}' -H "Origin: http://bad.com" -H "Content-Type: application/json"
----

+
Expand All @@ -245,12 +245,7 @@ tinymce.init({
selector: 'textarea#spellchecker', // change this value according to your HTML
plugins: 'code tinymcespellchecker link',
toolbar: 'spellchecker language spellcheckdialog',
spellchecker_language: 'en_US',
spellchecker_language: 'en-US', // Note: Using RFC5646 format with hyphen
spellchecker_rpc_url: "http://localhost:18080"
});
----





32 changes: 16 additions & 16 deletions modules/ROOT/partials/misc/spellchecker-languages.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ The following languages are supported for the Spell Checker plugin. All of the l
[cols="2,^1,^1,^1",options="header"]
|===
|Language |Code |Pre-packaged with {productname} |Supported Hunspell dictionaries
|Afrikaans (South Africa) |af_ZA |{cross} |{tick}
|English (Australia) |en_AU |{cross} |{tick}
|English (Canada) |en_CA |{cross} |{tick}
|English (United Kingdom) |en_GB, en_UK, en_BR |{tick} |{tick}
|English (United States) |en, en_US |{tick} |{tick}
|Medical English (US) |en-medical, en_US-medical |{tick} |{tick}
|Medical English (UK) |en_GB-medical |{tick} |{cross}
|Afrikaans (South Africa) |af-ZA |{cross} |{tick}
|English (Australia) |en-AU |{cross} |{tick}
|English (Canada) |en-CA |{cross} |{tick}
|English (United Kingdom) |en-GB, en-UK, en-BR |{tick} |{tick}
|English (United States) |en, en-US |{tick} |{tick}
|Medical English (US) |en-medical, en-US-medical |{tick} |{tick}
|Medical English (UK) |en-GB-medical |{tick} |{cross}
|Danish |da |{tick} |{tick}
|Dutch |nl, nl_NL |{tick} |{tick}
|Dutch |nl, nl-NL |{tick} |{tick}
|Finnish |fi |{tick} |{cross}
|French |fr |{tick} |{tick}
|German |de, de_DE |{tick} |{tick}
|German |de, de-DE |{tick} |{tick}
|Hungarian |hu |{cross} |{tick}
|Italian |it, it_IT |{tick} |{tick}
|Maori (New Zealand) |mi_NZ |{cross} |{tick}
|Norwegian Bokmål |nb, nb_NO |{tick} |{tick}
|Italian |it, it-IT |{tick} |{tick}
|Maori (New Zealand) |mi-NZ |{cross} |{tick}
|Norwegian Bokmål |nb, nb-NO |{tick} |{tick}
|Norwegian Nynorsk |nn |{cross} |{tick}
|Polish |pl |{cross} |{tick}
|Portuguese (Brazil) |pt, pt_BR |{tick} |{tick}
|Portuguese (Portugal) |pt_PT |{tick} |{tick}
|Portuguese (Brazil) |pt, pt-BR |{tick} |{tick}
|Portuguese (Portugal) |pt-PT |{tick} |{tick}
|Spanish |es |{tick} |{tick}
|Swedish |sv, sv_SE |{tick} |{tick}
|Swedish (Finland) |sv_FI |{cross} |{tick}
|Swedish |sv, sv-SE |{tick} |{tick}
|Swedish (Finland) |sv-FI |{cross} |{tick}
|===
Loading