Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I don't know if this issue belongs to the languagefield module or to Drupal core, but here it is. I have a use case where I need to upload documents available in the Dari language. This language is an official language part of the ISO standard and IANA registry:
- http://www-01.sil.org/iso639-3/documentation.asp?id=prs
- http://www.iana.org/assignments/language-subtag-registry/language-subtag... and search for prs
However, it is not available in the _locale_get_predefined_list function.
What should I do then, to be able to add documents in this language ?
Comment | File | Size | Author |
---|---|---|---|
#14 | 2116687-languagefield_hook_alter-14.patch | 429 bytes | guillaumev |
#1 | 2116687-new_language-1.patch | 621 bytes | guillaumev |
Comments
Comment #1
guillaumev CreditAttribution: guillaumev commentedAs a temporary solution, I did this (see patch attached) but it is not a real solution...
Comment #2
johnvThe language field offers an option 'all installed languages'. You should be able to create the language Dari using core/locale under 'Regional settings' (even if it is not in the list, if this is not possible, it is a core/locale issue). You can then disable the language, to prevent any users setting this language in his/her account. But using the options, the Dari languge is in the language field.
Comment #3
guillaumev CreditAttribution: guillaumev commentedThanks, but then it means that I would also need to create languages for all of the other languages I want to provide an option for. Would there be a way to do a "mix" of the predefined languages and the installed languages ?
Comment #4
johnvSorry, languagefield does not provide an option by itself to add/create new languages.
Comment #5
ShaneOnABike CreditAttribution: ShaneOnABike commentedUnfortunately, that doesn't really work as you suggested. Mainly, because if I select the list of pre-defined cause I want to supply those for a list of Artists say... then it only uses those and doesn't include any new regional ones I added. I just tried this today and it didn't work properly :( Is there not an option to add a checkbox to add additional ones that have been added by hand perhaps?
Comment #6
johnvSo this would mean to change the first radio button in "Field settings - Enabled Languages" from 'All Predefined languages' to 'All Predefined and installed languages'?
Comment #8
johnvAdjacent patch converts the single-value radiobutton in the field settings to multi-value language set.
Now you can choose predefined languages AND custom languages.
Comment #10
johnvComment #14
guillaumev CreditAttribution: guillaumev commentedActually I'm reopening this, because adding Dari as a custom language in the Drupal interface doesn't work for me. Doing this adds Dari as a language EVERYWHERE (even when disabled), so that nodes and content can be translated to Dari, which is not something I want (I want Dari to appear ONLY in the language fields). I therefore created a patch for languagefield, which adds a hook_alter to the _languagefield_options function, allowing developers to alter the list of languages in other modules.
Comment #15
johnv@guillaume, this seems like a regression error in D7 core. (In D8, the 'disabled languages' do not exist anymore.)
You should not be able to translate into disabled languages. Did you test with Languagefield disabled? Please add an issue in the core language.module issue queue?
Comment #16
johnv@guillaumev : Hmm, I cannot reproduce this: Addinga custom language, and disabling it after that, I cannot choose in in E.g. the user language.