signalpoint / DrupalGap

An application development kit for Drupal websites.
https://www.drupalgap.org
GNU General Public License v2.0
232 stars 186 forks source link

Contact form in different languages: how to access a particular contact form? #831

Open ReisQuarteu opened 8 years ago

ReisQuarteu commented 8 years ago

Hi.

I have a Drupal-based web site, which has versions written in 5 languages. I have all the related modules (i18n, entity translation) up and running smoothly. The web site has a site-wide contact form available at http://www.mywebsite.com/contact (in English), as well as its corresponding forms at the other languages:

I am now developing a mobile app based on that web site. At the app, I also have the 5 languages of the web site, and the app must also have the same site-wide contact form. Putting the English contact form into the app was a snap: I just did what the Drupalgap's documentation says to do. But if I try to put, for example, the French contact form into the app, it's not so obvious. If I navigate to the "contact" path, I end up with the English contact form; If I try to navigate to the "fr/contact", I get a 404. If I define an alias for the "fr/contact" path (say, "fr/contacter"), navigating to the new alias also ends up with a 404.

Any ideas? Or am I missing something obvious here?

Many Thanks in advance! :)

signalpoint commented 8 years ago

@ReisQuarteu The contact module in DrupalGap would need to be expanded to support language codes: https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/contact/contact.js

As you can see, there are only 2 items provided in contact_menu, we would need more to handle language codes, e.g. contact/%, could be used a wildcard to route it to a page that was language specific. The Services Contact module may also need to evolve to make this possible: https://www.drupal.org/project/services_contact

It's neat how Drupal can prefix entire paths with a language code, and then translate the page properly. DrupalGap unfortunately doesn't support that. To learn more about multilingual capabilities in DrupalGap: http://docs.drupalgap.org/7/Translate

ReisQuarteu commented 8 years ago

Thanks for your kind answer! :)

I cannot see the contact module at the Drupalgap contrib modules web page. Is this module necessary for my app in any way? As I said above, the English contact form works smoothly.

To address my issue, I think the best way is to build brand new Drupalgap forms for each language other than English. By now, I'm not really sure about how I can send an email from the app using the data entered in those forms. Is there any approach to achieve this in Drupalgap?

I have already read the documentation about the multilingual capabilities in Drupalgap, but when I saw this "Switching languages dynamically ...", I tried another approach to implement multilingual features in my app. :)

Many thanks in advance! :)

signalpoint commented 8 years ago

@ReisQuarteu The contact module is included in DrupalGap core: https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/contact/contact.js

To read about collecting data in DrupalGap and sending it to Drupal, these pages are best:

http://docs.drupalgap.org/7/Forms/Creating_a_Custom_Form http://docs.drupalgap.org/7/Services/Create_a_Custom_Service/Custom_Service_Resource_with_Arguments