2016-09-08 14 views
5

पर आधारित मुद्रा प्रतीक और प्रारूप को कैसे अनुकूलित करें I मुद्रा प्रारूप पैटर्न, मुद्रा प्रतीक और मुद्रा प्रतीक स्थिति को प्रोग्रामेटिक रूप से बदलना चाहते हैं। मुझे फ़ोल्डर विक्रेता \ magento \ zendframework1 \ library \ Zend \ Locale \ डेटा में कुछ डेटा मिला।Magento 2 लोकेल

उदाहरण के लिए यदि मैं कोड का पालन करके fr_FR.xml में प्रारूप बदलता हूं तो यह फ्रंटेंड में प्रतिबिंबित होता है।

<numbers> 
     <currencyFormats numberSystem="latn"> 
      <currencyFormatLength> 
       <currencyFormat type="standard"> 
        <pattern>¤ #,##0.00</pattern> 
       </currencyFormat> 
       <currencyFormat type="accounting"> 
        <pattern>¤ #,##0.00;(¤ #,##0.00)</pattern> 
       </currencyFormat> 
      </currencyFormatLength> 
      <unitPattern count="one">{0} {1}</unitPattern> 
      <unitPattern count="other">{0} {1}</unitPattern> 
     </currencyFormats> 
     <currencies> 
      <currency type="GBP"> 
       <displayName>livre sterling</displayName> 
       <displayName count="one">livre sterling</displayName> 
       <displayName count="other">livres sterling</displayName> 
       <symbol>£</symbol> 
      </currency> 
     </currencies> 
</numbers> 

लेकिन मुझे पता है कि कैसे डिफ़ॉल्ट fr_FR.xml ओवरराइड करना चाहते (विक्रेता \ Magento \ zendframework1 \ पुस्तकालय \ Zend \ लोकेल \ Data \ fr_FR.xml)

कृपया मुझे पता है अगर किसी को जाने करने का तरीका

+0

आप वेबसाइट पर या केवल कुछ दृश्य या मॉड्यूल में उन्हें बदलना चाहते हैं? और क्या, एक विशिष्ट लोकेल के लिए? –

+0

आपकी प्रतिक्रिया के लिए बहुत बहुत धन्यवाद .. मुझे उस विशिष्ट लोकेल fr_FR के लिए पूरी वेबसाइट की आवश्यकता है। – Shan13

+0

इस उत्तर को जांचें https://magento.stackexchange.com/questions/61337/how-to-use-locale-files –

उत्तर

3

एक पूर्ण समाधान नहीं हो सकता है, लेकिन यह एक अच्छी शुरुआत होनी चाहिए। नीचे कोड प्रवाह का क्रम है।

  • public function formatTxt मॉड्यूल-निर्देशिका/मॉडल/Currency.php पर। यह फ़ंक्शन को कॉल toCurrency जो बारी में
  • पर public function toCurrency करने के लिए कॉल zendframework1/पुस्तकालय/Zend/Currency.php

जब आप समारोह मिल जाए, आप $ विकल्प सरणी चर जो सभी आवश्यक जानकारी शामिल फ़ॉर्मेट करने के लिए दिखाई देगा मूल्य मूल्य। $ विकल्प के var_dump नीचे है। array(12) { ["position"]=> int(16) ["script"]=> NULL ["format"]=> NULL ["display"]=> int(2) ["precision"]=> int(2) ["name"]=> string(9) "US Dollar" ["currency"]=> string(3) "USD" ["symbol"]=> string(1) "$" ["locale"]=> string(5) "en_GB" ["value"]=> int(0) ["service"]=> NULL ["tag"]=> string(11) "Zend_Locale" }

तो मुद्रा प्रतीकों बढ़ने के लिए आप

DI.xml <preference for="Magento\Directory\Model\Currency" type="Yourpack\Custom\Model\Currency" />

साथ public function formatPrecision ओवरराइड और आवश्यक मूल्यों के साथ विकल्प सरणी पारित कर सकते हैं।

उदाहरण के लिए: $options['position'] = 16 will move the currency symbol to the right of the currency value (16.24$) इसी तरह ओवरराइड करने के लिए आवश्यक सरणी विकल्प पास करें।

+0

धन्यवाद बहुत फ्रैंक। मुझे बहुत मदद मिली। मुद्रा प्रतीक को लोकेल के अद्वितीय स्वतंत्र कैसे बनाएं? – Shan13

संबंधित मुद्दे