S
S
Sergei2016-01-19 13:00:44
WordPress
Sergei, 2016-01-19 13:00:44

Plugin for wordpress translation of physical quantities?

Dear community,
Tell me if there is such a WordPress plugin as the translation of physical quantities. Such here as here...
Thanks!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Kozlov, 2016-01-20
@viruhost

The example site uses the google converter script. Google has a constructor for such a converter. You set it up. Then Google issues a script. Then you insert it on the site on the desired page or post.
Or you can pull the code from the example.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
    var units = {"mass":{"1":"\u0413\u0440\u0430\u043c\u043c","0.2":"\u041a\u0430\u0440\u0430\u0442","1000":"\u041a\u0438\u043b\u043e\u0433\u0440\u0430\u043c\u043c","1000000":"\u0422\u043e\u043d\u043d\u0430","0.001":"\u041c\u0438\u043b\u0438\u0433\u0440\u0430\u043c\u043c","101.97160050137":"\u041d\u044c\u044e\u0442\u043e\u043d","16380.483243912":"\u041f\u0443\u0434","31.103473480401":"\u0423\u043d\u0446\u0438\u044f \u0422\u0440\u043e\u0439\u0441\u043a\u0430\u044f","453.5922921969":"\u0424\u0443\u043d\u0442 \u0410\u043c\u0435\u0440\u0438\u043a\u0430\u043d\u0441\u043a\u0438\u0439","373.24170498304":"\u0424\u0443\u043d\u0442 \u0422\u0440\u043e\u0439\u0441\u043a\u0438\u0439","100000":"\u0426\u0435\u043d\u0442\u043d\u0435\u0440"},"length":{"0.1":"\u0414\u0435\u0446\u0438\u043c\u0435\u0442\u0440","0.0253999991872":"\u0414\u044e\u0439\u043c \u0438\u043c\u043f\u0435\u0440\u0441\u043a\u0438\u0439","219.45600367984":"\u041a\u0430\u0431\u0435\u043b\u044c\u0442\u043e\u0432","1000":"\u041a\u0438\u043b\u043e\u043c\u0435\u0442\u0440","1":"\u041c\u0435\u0442\u0440","0.001":"\u041c\u0438\u043b\u0438\u043c\u0435\u0442\u0440","1852.0000118528":"\u041c\u0438\u043b\u044f \u043c\u043e\u0440\u0441\u043a\u0430\u044f","0.01":"\u0421\u0430\u043d\u0442\u0438\u043c\u0435\u0442\u0440","0.3047999902464":"\u0424\u0443\u0442","0.91440024944839":"\u042f\u0440\u0434","0.0042333328394445":"\u0426\u0438\u0446\u0435\u0440\u043e"},"volume":{"0.15898728912522":"\u0411\u0430\u0440\u0435\u043b\u044c \u043d\u0435\u0444\u0442\u044f\u043d\u043e\u0439","0.036368794119893":"\u0411\u0443\u0448\u0435\u043b\u044c","0.0037854111013237":"\u0413\u0430\u043b\u043e\u043d \u0436\u0438\u0434\u043a","0.001":"\u0414\u0435\u0446\u0438\u043c\u0435\u0442\u0440 \u043a\u0443\u0431\u0438\u0447\u0435\u0441\u043a\u0438\u0439","0.0009463531335645":"\u041a\u0432\u0430\u0440\u0442\u0430","0.00047317656678225":"\u041f\u0438\u043d\u0442\u0430 \u0436\u0438\u0434\u043a","0.76455463545653":"\u042f\u0440\u0434 \u043a\u0443\u0431\u0438\u0447\u0435\u0441\u043a\u0438\u0439","1":"\u041c\u0435\u0442\u0440 \u043a\u0443\u0431\u0438\u0447\u0435\u0441\u043a\u0438\u0439"},"time":{"875963.55991591":"\u0412\u0435\u043a","8766.0012395126":"\u0413\u043e\u0434 \u044e\u043b\u0438\u0430\u043d\u0441\u043a\u0438\u0439","719.99999424":"\u041c\u0435\u0441\u044f\u0446 \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u043d\u044b\u0439","2.777777777777":"\u041c\u0438\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430","0.016666666666667":"\u041c\u0438\u043d\u0443\u0442\u0430","0.00027777777777778":"\u0421\u0435\u043a\u0443\u043d\u0434\u0430","24":"\u0421\u0443\u0442\u043a\u0438","1":"\u0427\u0430\u0441"},"area":{"4046.8561188869":"\u0410\u043a\u0440","10000":"\u0413\u0435\u043a\u0442\u0430\u0440","1000000":"\u041a\u0438\u043b\u043e\u043c\u0435\u0442\u0440 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439","2590002.5900026":"\u041c\u0438\u043b\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0430\u044f","0.092903043596611":"\u0424\u0443\u0442 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439","0.8361273923695":"\u042f\u0440\u0434 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439","1":"\u041c\u0435\u0442\u0440 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0439"},"speed":{"1":"\u041a\u043c \u0432 \u0447\u0430\u0441","1.609344210116":"\u041c\u0438\u043b\u044f \u0432 \u0447\u0430\u0441","1.8519995164223":"\u0423\u0437\u0435\u043b"}};

    pic1= new Image(16,16);
    pic1.src="/templates/blank_j15/images/ajax_load.gif";
    
</script>
<div class="google_converter">
    <h3>
        Перевод физических величин    </h3>
    <div class="converter_div">
        <div class="converter_div2">
            <table class="converter_table" border="0" cellspacing="0">
                <tr>
                    <td>
                        <div class="title">
                            Еденицы измерения                        </div>
                        <div class="units">
                            <select id="units" name="units" style="width: 250px;">
                                                                    <option value="mass">Масса</option>
                                                                    <option value="length">Длинна</option>
                                                                    <option value="volume">Объем</option>
                                                                    <option value="time">Время</option>
                                                                    <option value="area">Площадь</option>
                                                                    <option value="speed">Скорость</option>
                                                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="from_tabel">
                            Из                            </div>
                            <div class="from_input">
                                <select id="convert_from" class="sub_units" name="from" style="width: 350px;">
                                    <option selected="selected" value="">
                                    Выбирите еденицу измерения                                </option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="to_label">
                            В                                </div>
                                <div class="to_input">
                                    <select id="convert_to" class="sub_units" name="to" style="width: 350px;">
                                        <option selected="selected" value="">
                                    Выбирите еденицу измерения                                </option>
                            </select>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="quantity">
                            Количество                                </div>
                                <div class="convert_number">
                                    <input id="convert_number" type="text" value="1" name="number" />
                                </div>
                                <div class="convert_submit">
                                    <input id="convert_submit" type="button" value="Перевести" />
                                    <img id="ajax_load" src="/templates/blank_j15/images/ajax_load.gif" alt="" />
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="google_converter_after_div1"></div>
            <div class="google_converter_after_div2"></div>
        </div>

        <div id="google_converter_result_div" class="google_converter">
            <h3>
        Результат    </h3>
    <div class="converter_div">
        <div class="converter_div2">
            <span id="converter_result"></span>
        </div>
    </div>
    <div class="google_converter_after_div1"></div>
    <div class="google_converter_after_div2"></div>
</div>

<script type="text/javascript">
    function unitChanged(unit) {
        var html = '';

        for (var sub_unit in units[unit]) {
            var value = units[unit];
            html += '<option value="' + sub_unit + '">' + value[sub_unit] + '</option>\n';
        }

        $('.sub_units').html(html);
    }

    unitChanged('mass');

    $('#units').change(function(){
        var cur_unit = $(this).val();
        unitChanged(cur_unit);
    });
    $('#convert_submit').click(function(){
        $('#ajax_load').css('display', 'inline-block');
        var convert_from = $('#convert_from').val();
        var convert_to = $('#convert_to').val();
        var convert_number = $('#convert_number').val();

        var answer = (convert_from / convert_to) * convert_number;

        var from_string = $('#convert_from').val();
        from_string = $('#convert_from option[value=' + from_string + ']:first').text();
        var to_string = $('#convert_to').val();
        to_string = $('#convert_from option[value=' + to_string + ']:first').text();
        var result = convert_number + ' ' + from_string + ' = <strong>' + answer + '</strong> ' + to_string;
        $('#converter_result').html(result);
        $('#google_converter_result_div').css('display', 'block');
        $('#ajax_load').css('display', 'none');
    });
</script>

A
Anatoly Filippov, 2016-01-20
@filippovanatoliy

I looked for something I didn’t find - if only I write it myself: We write a simple converter "
I would write it myself and insert it directly into the topic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question