# This file is sourced not run

# make-pot.sh configuration file for smb-browser project

# ------------------------------------------------------------------- {{{1}}}
# Required project settings {{{1
# Output file name
FPOT=smb-browser.new.pot
# Input encoding
IENC=UTF-8
# Output encoding
OENC=UTF-8

# Firstly $XSRC source file is scanned for msgids with xgettext $XOPT (default --from-code=$IENC -L Shell)
# Anchor relative paths to /usr/
XSRC=../../../../../usr/share/Shares/Network/AppRun
XOPT="-ci18n --no-location"

# Then $XTBL source file is scanned for msgids with $XXGT (default --from-code=$IENC -L Shell)
# Anchor relative paths to /usr/
XTBL=../../../../../usr/share/Shares/Network/scripts/i18n_table.sh
XXGT=./xgettext.sh
XXGTOPT="-- -ci18n --no-location"

# Multiple files in list_md_files() are scanned for msgids with mdview --po {{{2
# Return immediately to skip markdown content
list_md_files()
{
  return # skip markdown content
  # because files in $d are in a different TEXTDOMAIN: fatdoghelp

  local d=../../../doc/fd-help
  set +f
  printf "%s\n" "$d/"*.md
}

# Any markdown file that fails the md_is_to_be_translated test will be skipped {{{2
md_is_to_be_translated() # $1-filepath
{
  case $f in
    */TRANSLATING.md)
      : "$f is for translators - they need English doc only"
      ;;
    */examples/*)
      : "$f not now - maybe translate examples in a future release"
      ;;
    */LICENSE.md)
      : "keep $f in English as GNU GPL does not endorse translations"
      ;;
    *) # translate all other files
      : "$f is for end users - translate it"
      return 0
      ;;
  esac
  return 1
}

# ------------------------------------------------------------------- {{{1}}}
# Required pot header settings {{{1
PACKAGE_VERSION="2.2.0"
PACKAGE_NAME="smb-browser"
PACKAGE_TITLE="smb-browser $PACKAGE_VERSION"
PACKAGE_COPYRIGHT="Fatdog64 Linux, public domain"
PACKAGE_FIRST_POT_AUTHOR="step, https://github.com/step-/"
PACKAGE_POT_CREATION_TZ="UTC"
PACKAGE_POT_LANGUAGE="en"
PACKAGE_CHARSET="$OENC"
PACKAGE_POT_BUGS_ADDRESS="https://distro.ibiblio.org/fatdog/web/"

# ------------------------------------------------------------------- {{{1}}}
# ------------------------------------------------------------------- {{{1}}}
# Function __notes_on_pot_file is called to insert starting notes before all extracted msgids
__notes_on_pot_file() # {{{1
{
  echo '
#. Example of Plural-Forms value valid for English; adapt for your language:
#.   "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#.
#. =======================================================================
#. i18n User documentation in markdown format from .md files follows.
#. i18n IMPORTANT! Reproduce indentation and special punctuation exactly.
#. =======================================================================
#.
'
}


# ------------------------------------------------------------------- {{{1}}}
# For each scanned <filename>.ext __notes_on_<filename> is called to insert notes before its extracted msgids
# unless the line __notes_on_file_<filename> includes pattern the word "excluded"
__notes_on_file_LICENSE() #{{{1 # is excluded from the pot file
{
  echo "
#. i18n File LICENSE.md is a special case. Do not to translate it. Instead
#. i18n find a translation from http://www.gnu.org/licenses/translations.html
#. i18n and use that translated text here.
#.
"
}

# ------------------------------------------------------------------- {{{1}}}
# {{{1
# vim:ft=sh:
