Skip to content

Latest commit

 

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Here you will find a number of helpful examples of how you can use spreak.

Setup

Follow these setup to run the helloworld example:

  1. Get the code
$ git clone https://github.com/vorlif/spreak
  1. Run the code
cd spreak/examples/helloworld
go run main.go

What is included?

Unless otherwise required for the demonstration, all .pot files and the associated translations are stored in the folder locale.

  • helloworld

    • Simple example to demonstrate how spreak can be used
    • xspreak command xspreak -e -D helloworld/ -p locale/ -d helloworld
  • dayinfo

    • Advanced example to demonstrate how spreak can be used with xspreak
    • xspreak command xspreak -e -D dayinfo/ -p locale/ -d dayinfo
  • httptempl: Example of how to use spreak with a web server and http/templates

  • jhttptempl: Example of how to use spreak with a web server, json and http/templates

  • embed: Example how spreak can be used with the embed api

  • errors: Example how errors can be translated with spreak and xspreak

  • loaders: Example how to load PO files from other sources

  • resolver: Example how to resolve the path to a file with translations.

  • printer: Example how to use your own printer

  • decoder: Example of implementation of a decoder and a catalog for importing JSON files for translation.