首页 > 解决方案 > 谷歌翻译问题与下拉

问题描述

我的网站使用谷歌翻译时出现问题,问题是当我选择英语以外的任何其他语言时,不是我的国家下拉列表中的所有记录都被翻译?

250 个国家/地区名称中的以下代码仅翻译顶部的 20 和底部的 10-15,但中间没有任何翻译

<div class="row form-group">
    <div class="col-md-12">
        <label class="sr-only" for="country">Your nationality? </label>
        <select name="country" class="form-control">
        <option value="" selected="selected" disabled="disabled">Your nationality? </option>
        <?php                   
        $stmt = $db->prepare('select * from country order by countryname asc');
        $stmt->execute();
        $row = $stmt->fetchAll(PDO::FETCH_ASSOC);
        foreach($row as $rows){
        ?>
        <option value="<?php echo $rows['countryname']; ?>" <?php if($country == ''.$rows['countryname'].'') echo 'selected="selected"'; ?>><?php echo $rows['countryname']; ?></option>                                
        <?php
        }
        ?>
        </select>       
    </div>
</div>

但是后来我尝试使选择字段 size="4" 如果我​​使用 size 属性并使下拉列表更大,那么一切都会被翻译。

这是什么奇怪的问题以及如何解决它?

这种方式可以工作,但我不希望使下拉大小更大。

<div class="row form-group">
    <div class="col-md-12">
        <label class="sr-only" for="country">Your nationality? </label>
        <select name="country" class="form-control" size="4">
        <option value="" selected="selected" disabled="disabled">Your nationality? </option>
        <?php                   
        $stmt = $db->prepare('select * from country order by countryname asc');
        $stmt->execute();
        $row = $stmt->fetchAll(PDO::FETCH_ASSOC);
        foreach($row as $rows){
        ?>
        <option value="<?php echo $rows['countryname']; ?>" <?php if($country == ''.$rows['countryname'].'') echo 'selected="selected"'; ?>><?php echo $rows['countryname']; ?></option>                                
        <?php
        }
        ?>
        </select>       
    </div>
</div>

谢谢

标签: phphtmlpdodropdowngoogle-translator-toolkit

解决方案


推荐阅读