Hello,

I was looking in the RFC 4646 in term of letter case for language-code.
Instead of defining language-code in all lowercase, it should use uppercase for the region part.
Example zh-hans => zh-Hans.

So I start talking in this issue : http://drupal.org/node/1231402#comment-7172196

The idea is to stay consistent, in most of the other third-part they follow the recommendation, so when we want to integrate something, we are not consistent, I think is a best practice to follow those recommendation.

Thanks

Comments

Gábor Hojtsy’s picture

Version: 7.x-dev » 8.x-dev

How do you imagine such a change happening? Would you take existing data in Drupal releases and update with old language codes to new language codes? How do you tell what uses language? Once you change the main language code value, relation of those to other data elements would break. So we would need to update all data, which we cannot really tell given whatever module can reference the core Drupal data including contributed and custom modules on sites.

Are you proposing to only change for new sites, not for existing sites? How do you imagine to do that?

Also we currently use language codes in Drupal releases in several versions as well as localize.drupal.org group setup and file export names. The language codes are syncronized, so zh-hans on localize.drupal.org feeds zh-hans on a Drupal website. If we change it on the Drupal side, the translation exports will not feed into Drupal clients proper anymore.

Since you keep referring to RFC 4646, just pointing out again that it has long been obsoleted by BCP 47 (http://www.w3.org/International/articles/language-tags/).

The entries in the registry follow certain conventions with regard to upper and lower letter-casing. For example, language tags are lower case, alphabetic region subtags are upper case, and script tags begin with an initial capital. This is only a convention! When you use these subtags you are free to do as you like, unless you are constrained by the rules of the system you are working with. For HTML and XML language markup, the case should not matter.

(Emphasis from me).

Finally, Drupal core changes by policy happen first in the latest version and backported. So also not sure how to make these changes across 3 major Drupal versions relatively at the same time (or build compatibility layers into all of them).

sir_squall’s picture

Hello Gábor Hojtsy,

If you take time to look they use all this convention:

PHP

Wordpress

Symfony

Java

  • http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html
  • The language field is case insensitive, but Locale always canonicalizes to lower case.
  • The script field is case insensitive, but Locale always canonicalizes to title case (the first letter is upper case and the rest of the letters are lower case).

Etc...

In the BCP 47 : On the other hand, you may be using language tags in a context where letter-case is important, such as file names on some systems. In such cases, you should ensure that you follow a consistent policy for letter-case; for any new system that is not case-insensitive, it is recommended that you follow the BCP 47 conventions

I don't say it's an easy task to do. That's why I open the issue, to talk and find what is the best way to implement such change. As the moment, I don't have any solution to resolve this issue.

Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-base

Given the quote above from BCP 47 (especially with the complexity explained with the intertwined systems) I'm not planning to work on this issue. However, most multilingual issues were not solved by me in Drupal 8, so that is no stop sign for people interested to solve the problem.

xmacinfo’s picture

Category: support » feature

Please note that the vast majority of languages (2-letter lowercase code) for Drupal are for the international version of the language, not the localized ones.

Language “en” alone is not USA-based, Canadian-based or UK-based for that matter. Same thing for the “fr” language on Drupal. We do not have any localized language yet, unless a few exists on http://localize.drupal.org/.

To officially go from 2-letter code to 4-letter code, we would need to fix all the available translation to:

  • create an official international version (2-letter code), actually make them official),
  • create localized version of each language (4-letter code, e.g. “fr-CA” for French Canadian),
  • ask translators to offer fully-localized version of each languages (that have documented local differences),
  • ask translators to fully make international the current languages on the system, by reviewing the current translations,
  • modify the installer to load the localized version of the translation,
  • etc.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

skyredwang’s picture

Issue summary: View changes

Just to provide another reference:

BCP 47: 2.1.1. Formatting of Language Tags

At all times, language tags and their subtags, including private use
and extensions, are to be treated as case insensitive: there exist
conventions for the capitalization of some of the subtags, but these
MUST NOT be taken to carry meaning.

Thus, the tag "mn-Cyrl-MN" is not distinct from "MN-cYRL-mn" or "mN-
cYrL-Mn" (or any other combination), and each of these variations

Phillips & Davis Best Current Practice [Page 6]

RFC 5646 Language Tags September 2009

conveys the same meaning: Mongolian written in the Cyrillic script as
used in Mongolia.

The ABNF syntax also does not distinguish between upper- and
lowercase: the uppercase US-ASCII letters in the range 'A' through
'Z' are always considered equivalent and mapped directly to their US-
ASCII lowercase equivalents in the range 'a' through 'z'. So the tag
"I-AMI" is considered equivalent to that value "i-ami" in the
'irregular' production.

Although case distinctions do not carry meaning in language tags,
consistent formatting and presentation of language tags will aid
users. The format of subtags in the registry is RECOMMENDED as the
form to use in language tags. This format generally corresponds to
the common conventions for the various ISO standards from which the
subtags are derived. ---- https://www.rfc-editor.org/rfc/rfc5646.html#section-2.1.1

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.