Git Product home page Git Product logo

Comments (3)

dryabov avatar dryabov commented on June 20, 2024

First, I'd like to note that JEDChecker issues a warning, not an error.

Actually, there are two problems with your approach:

  1. Joomla uses a single registry for translations, so one extension can overwrite strings of another extension. For example, one extension may translate "Czech" to "Tscheche" for de-DE locale, but the other does it to "Tschechin" or "Tschechisch". As a solution to this problem, it is highly recommended to use language keys with a unique prefix (e.g. COM_MYEXTENSION__COUNTRY_CZECH), but this, in turn, means that situations, where Joomla outputs the original key, should not occur. A standard approach to solve the problem, when the translation file does not contain some values, is to load the English translation file and then the current language translation file to overwrite values. If I'm not mistaken, in Joomla 3.2+ it is done automatically, and in older Joomla versions it had to be done manually.

  2. Translators may use third-party utilities to work with ini-files, and I'm not sure all of them support keys with spaces. For convenience, it is better to use a common denominator of avoiding PHP-specific things there (i.e., spaces in keys, the injection of constants into string values ​​via ${CONST}, etc.).

from jedchecker.

jschmi102 avatar jschmi102 commented on June 20, 2024

JEDchecker clearly issues an error (message even is color coded in red):
grafik
I cannot folllow your arguments if an extension uses the joomla language interface correctly there may not be any collision - on the other hand I'm using only common country names (iso standard names), which cannot cause wrong translation. (e. g. "Germany" will always translate to "Deutschland")

I'm seeing these facts for my implementation:

  • php does not report any errors, warnings or notices
  • joomla does not report any errors, warnings or notices
  • my extension (module) successfully uses the design of joomla's multi-language support (no errors, no warnings)
  • sofar I did not find any joomla docs saying "white space in language keys is not allowed"

My implementation for german language support (as used right now) needs only 3 lines of code plus some entries in a language ini-file.
Therefore I think it would be silly to comletely change design and coding only to make JEDChecker happy.

from jedchecker.

dryabov avatar dryabov commented on June 20, 2024

Hmm, I've found original reason to make it error. There was the Specification of language files page on docs.joomla.org with the following requirements:

  1. The KEY is now defined to be
    • without any whitespace. All whitespace shall be converted into a underscore '_'
    • All KEY's in the frontend shall include a prefix of the extension

I don't know why this page was removed without a replacement.

PS. My opinion is that, in general, all rules except of "core" ones (Info, License, XML Manifests, XML Files, GPL License) should trigger warnings instead of errors. But at the same time I think that "error" is a proper level in this particular case: using of a raw text instead of a prefixed keys in language file is ok for local development, but not for JED, because it may lead to conflicts between different extensions.

from jedchecker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.