miramarfun Posted September 26, 2017 Share Posted September 26, 2017 Hello everyone, I have a portion of php code for managing 2 languages in a Dropdown and translated directly with the files fr_FR.po and en_GB.po with followed by the currency. - flags + French + € My question is the following because I start and I would like to add 7 other languages. Here's the code portion: <section class="Footer-locales"> <div class="u-relative"> <div class="o-flux" data-toggle="dropdown"> <div class="o-flux-body"> <div class="c-input u-alignLeft dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false" aria-controls="locale-dropdown"> <input type="text" id="footerSelectLocale" class="c-input-field is-focused u-white-bg u-cursorPointer" value="<?php if($_SESSION['locale']=='en_GB'){ echo 'English';}else{echo 'Français';}?> <?php echo $currency['symbol'];?>" readonly=""> <label for="footerSelectLocale" class="c-input-label"> <span>Language</span> </label> </div> </div> </div> <div id="locale-dropdown" class="Dropdown Dropdown--locales dropdown-menu NavigationMenu NavigationMenu--locales u-clearfix" style="width: 250px;"> <ul class="u-reset u-right"> <?php if($_SESSION['locale']=='en_GB') { $currecy=select_query("SELECT * FROM currency_table WHERE language='fr_FR'")[0]; ?> <li> <a data-lang="fr_FR" class="lang notranslate js-optInExcluded" rel="nofollow"> <img src="https://d1ovtcjitiy70m.cloudfront.net/vi-1/images/icons/flags/svg/fr.svg" alt="" aria-hidden="true" width="20" height="15"> French <?php echo $currecy['symbol'];?> </a> </li> <?php } else { $currecy=select_query("SELECT * FROM currency_table WHERE language='en_GB'")[0]; ?> <li> <a data-lang="en_GB" class="lang notranslate js-optInExcluded" rel="nofollow"> <img src="https://d1ovtcjitiy70m.cloudfront.net/vi-1/images/icons/flags/svg/gb.svg" alt="" aria-hidden="true" width="20" height="15"> English <?php echo $currecy['symbol'];?> </a> </li> <?php } ?> </ul> </div> I hope you can give me some help Thanks to all Link to comment Share on other sites More sharing options...
benanamen Posted September 26, 2017 Share Posted September 26, 2017 You are going about this wrong. You need to use proper templating such as TWIG instead of doing code gymnastics. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.