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:

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 ?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

guillaumev’s picture

FileSize
621 bytes

As a temporary solution, I did this (see patch attached) but it is not a real solution...

johnv’s picture

Title: Adding new languages » Adding new (custom) languages

The 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.

guillaumev’s picture

Thanks, 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 ?

johnv’s picture

Sorry, languagefield does not provide an option by itself to add/create new languages.

ShaneOnABike’s picture

Issue summary: View changes

Unfortunately, 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?

johnv’s picture

So this would mean to change the first radio button in "Field settings - Enabled Languages" from 'All Predefined languages' to 'All Predefined and installed languages'?

  • johnv committed c726f31 on 7.x-1.x
    Issue #2116687: Added possibility to choose both predefined and custom...
johnv’s picture

Category: Support request » Feature request
Issue tags: +needs-forward-port-to-8.x

Adjacent patch converts the single-value radiobutton in the field settings to multi-value language set.
Now you can choose predefined languages AND custom languages.

  • johnv committed cb149da on 8.x-1.x
    Issue #2116687: Added possibility to choose both predefined and custom...
johnv’s picture

Title: Adding new (custom) languages » Using new (custom) languages AND predefined languages
Status: Active » Fixed
Issue tags: -needs-forward-port-to-8.x

  • johnv committed 3a86616 on 7.x-1.x
    Issue #2116687: Fixed language checkboxes are required
    

  • johnv committed 4ffb55a on 8.x-1.x
    Issue #2116687: Fixed language checkboxes are required
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

guillaumev’s picture

Status: Closed (fixed) » Needs review
FileSize
429 bytes

Actually 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.

johnv’s picture

@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?

johnv’s picture

Status: Needs review » Fixed

@guillaumev : Hmm, I cannot reproduce this: Addinga custom language, and disabling it after that, I cannot choose in in E.g. the user language.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.