Add multiple languages for Jekyll web site

personal

jekyllmultiple-languages

  • 1.in the’_data’folder create a empty file named’ (language code).yml’

  • 2.in the file to list the need for multilingual translation of string, like “(StringKey:, StringValue) Key: Value’”. For more information, please refer to en.yml

  • 3.in _config.yml input language_default: '(your default language)'

  • 4.enter {% assign translation = site.data[site.language_default] %} in the file which to be referenced

  • 5.{{ translation.String }} can output the translation of ‘String’

In addition, if the translation string contains a jekyll(markdown) variable name or HTML tag: you can put the variable name or HTML content expressed by the addition of strings; using{% capture variable name %} Give the contents or values ​​of the variable here {% endcapture %}import the variable or html; at last use{{translation.String | replace: }}