Japanese 1.0 Seasoft Corporation 株式会社シーソフト slang.js is a javascript that supports the internationalization of websites. slang.js はWEBサイトの国際化をサポートする javascript です。 Overview 概要 Feature 特徴 How to write HTML HTMLの記述 Translation file 翻訳ファイル Feature 機能 Exchange image file 画像の差し替え Download ダウンロード Technical document 技術資料 Copyright 著作権情報 The copyright of slang.js and family scripts belong to Seasoft Corporation. slang.js および付属のスクリプトの著作権は株式会社シーソフトに帰属しています。 This software is released under the MIT License, see 本ソフトウェアのライセンスは MIT ライセンスです。次のドキュメントを参照ください。 slang.js translates and displays the contents of the homepage written in English according to the language setting of the browser. slang.jsは、英語で記載されたホームページの内容をブラウザの言語設定に合わせて翻訳表示します。 Instead of automatic translation, if the target text is prepared in advance, the target string in HTML is replaced and displayed. 自動的な翻訳ではなく、対象となるテキストを事前に用意している場合にHTML内の対象文字列を置換して表示するようになっています。 Unlike HTML, which is based on the native language, it is important that the language set in the browser to view the page is initially displayed. 母国語をベースに記載されるHTMLと違い、ページを閲覧するブラウザの設定言語が初期表示されることが重要です。 Maintenance is also improved by separating translation file resources. 翻訳ファイルのリソースが分離することで、メンテナンス性も向上します。 The writer himself is responsible for the content of the translation. 記述者自身に翻訳の内容に関する責任があることになります。 The HTML description method may be easy to understand if you display the source program of this page in a browser. HTMLの記述方法は、このページのソースプログラムをブラウザで表示していただくとわかりやすいかもしれません。 Please specify HTML language. HTMLの言語指定をしてください。 slang.js assumes that English(en) is specified if there is no language setting. slang.jsは言語設定がない場合英語が指定されているものとみなします。 load javascripts javascripts のロード The following files are required to specify javascript. javascript の指定は次のファイルが必要です。 Specify the 'slang' class in the body or the tag inside the body. body または body 内のタグに slang クラスを指定します。 When grouping blocks in HTML, add id to slang-group class. HTML内のブロックをグループ化する場合は、id に slang-group クラスを付けます。 The translation file is an XML format file with a language extension added to the HTML file name. 翻訳ファイルはHTMLファイル名に言語拡張子を付けたXMLフォーマットのファイルになります。 The language extension uses the first two characters of the browser language setting. 言語拡張子はブラウザの設定言語の先頭2文字を使用します。 For example, the Japanese translation file name for this sentence is 'slang.html.ja'. 例えば、この文章の場合の日本語翻訳ファイル名は slang.html.ja になります。 If you look at the actual file at the link below, you can see its structure. 以下のリンクで実際のファイルを見ていただけば、その構成がお分かりいただけます。 XML tags may not be displayed depending on the browser. ブラウザによってXMLのタグが表示されない場合があります。 The format of the translation file is simple, just prepare the translation contents for each sentence with Group, String, Source and Dest tags. 翻訳ファイルのフォーマットは簡単で、Group, String, Source, Dest のタグで文章ごとに翻訳内容を用意するだけです。 To change the image according to the language, change the folder name. 言語に合わせて画像を変更するには、フォルダ名を変えて対応します。 In slang_img.js, refer to the image with the same name by replacing the 'images/' folder name with the 'images_' + 'language extension'. slang_img.js では、images/ フォルダ名を images_言語拡張子に置き換えた同名の画像を参照します。 For example, the top image on this page is 'https://document.seasoft.co.jp/images/tech/slang/translate.png', but in Japanese, 'https://document.seasoft.co.jp/images_ja/tech/slang/translate.png'. たとえば、このページのトップ画像は、https://document.seasoft.co.jp/images/tech/slang/translate.png ですが、日本語表記の場合は https://document.seasoft.co.jp/images_ja/tech/slang/translate.png になります。 slang.js converts the HTML description written in English into another language, but the internal structure is string search and replacement, so it can also be used to convert from other languages to English. slang.js は英語表記のHTML記述を他の言語に変換しますが、内部構造は文字列の検索と置換となっているので、他の言語から英語に変換する目的でも利用できます。 If you already have a website written in Japanese, you can convert it to a site in English or another language simply by inserting the slang.js script and adding a translation file for replacement. 日本語で書かれたWEBサイトが既に存在する場合、slang.js スクリプトの挿入と、置換用の翻訳ファイルを追加するだけで英語や他の言語のサイトに変換できるようになります。 For the internal structure and technical information, see the next page. 内部構造や技術情報については次のページを参照してください。 You can download the file used on this page. このページで使用しているファイルをダウンロードできます。 Seasoft language translator main body slang.js メインスクリプト Translation tree node definitions 翻訳ツリーのノード定義 Image replacement script 画像置換用スクリプト Red-black tree script 赤黒木スクリプト Node definition of red-black tree 赤黒木のノード定義 By specifying the language in the URL parameter lang, the page translation can be specified language. URLパラメータ lang に言語指定をすることで、ページの翻訳を指定言語にすることができます。 To display this page in the specified language, write as follows. このページを指定言語で表示するには以下のように記述します。 Japanese 日本語 English 英語