21-9 ローカライズ

461ページ

config.yaml

l10n_lexicon:
    ja:
        ID: ID番号
        Number: 番号
        Enter any value you want here.: 値を入力してください

config.yaml

l10n_lexicon:
    ja: l10n_ja.yaml

l10n_ja.yaml

ID: ID番号
Number: 番号
Enter any value you want here.: 値を入力してください

system_config.tmpl

<mtapp:setting id="my_setting_id" label="<__trans phrase="ID">" hint="<__trans phrase="Enter any value you want here.">" show_hint="1">
<input type="text" name="my_setting_id" id="my_setting_id" value="<mt:GetVar name="my_setting_id">" />
</mtapp:setting>

462ページ

config.yaml

name: Example Plugin
id: Example
l10n_lexicon:
    ja:
        Name: 名前
        Price: 価格
        Size: サイズ

CMS.pm

...前略...
my $name = MT->translate('Name');
my $price = MT->translate('Price');
my $size = MT->translate('Size');
my $node = $tmpl->createElement('app:setting',
                   { id => 'size', label => $size, label_class => "top-label" });
my $innerHTML = '<input type="text" name="size" id="size" class="full-width" value="<mt:GetVar name="size" />" />';
$node->innerHTML($innerHTML);
$tmpl->insertAfter($node, $field);
$node = $tmpl->createElement('app:setting',
                   { id => 'price', label => $price, label_class => "top-label" });
$innerHTML = '<input type="text" name="price" id="price" class="full-width" value="<mt:GetVar name="price" />" />';
$node->innerHTML($innerHTML);
$tmpl->insertAfter($node, $field);
$node = $tmpl->createElement('app:setting',
                   { id => 'name', label => $name, label_class => "top-label" });
...後略...

このアーカイブについて

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。