This code is from Gorgias livechat app, I want to figure out if there's a way to build a rule based on Shopify store language (shop.locale or url string(fr,en)).
The applicationID determine the language of the helpdesk. So that's the only part affected that needs to change based on the rule. Here's the code for english livechat only only. French applicationID is 17741.
Can you help me build this rule?
<!--Gorgias Chat Widget Start-->
<script id="gorgias-chat-widget-install-v2" src="https://config.gorgias.chat/gorgias-chat-bundle-loader.js?applicationId=17634"></script>
<script id="gorgias-chat-shopify-install">!function(_){_.SHOPIFY_PERMANENT_DOMAIN="{{shop.permanent_domain}}",_.SHOPIFY_CUSTOMER_ID="{{customer.id}}",_.SHOPIFY_CUSTOMER_EMAIL="{{customer.email}}"}(window||{});</script>
<!--Gorgias Chat Widget End-->
use Shopify liquid request.locale to determine the current language and based on updated the application ID.

use like
{% assign appID = '' %} // you default ID
{% if request.locale.name == '' %}
{% assign appID = '' %} // language based ID
{% endif %}
and then
<!--Gorgias Chat Widget Start-->
<script id="gorgias-chat-widget-install-v2" src="https://config.gorgias.chat/gorgias-chat-bundle-loader.js?applicationId={{appID}}"></script>
<script id="gorgias-chat-shopify-install">!function(_){_.SHOPIFY_PERMANENT_DOMAIN="{{shop.permanent_domain}}",_.SHOPIFY_CUSTOMER_ID="{{customer.id}}",_.SHOPIFY_CUSTOMER_EMAIL="{{customer.email}}"}(window||{});</script>
<!--Gorgias Chat Widget End-->
if there is more than one language then use the case from the liquid.
You can read more about case and request.locale