Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,654 changes: 824 additions & 830 deletions MultilanguagePlugin.php

Large diffs are not rendered by default.

43 changes: 6 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Multilanguage (plugin for Omeka)

[Multilanguage] is an [Omeka] plugin that is a limited attempt to make parts of
Omeka multilanguage. It integrates the [locale switcher] from [BibLibre] for
public front-end and admin back-end, and [Translations], for management of
translations of specific or hard coded theme strings.
public front-end and admin back-end.


Installation
Expand All @@ -14,6 +13,9 @@ Uncompress files and rename plugin folder `Multilanguage`.

Then install it like any other Omeka plugin and follow the config instructions.

The plugin [Translations] may be useful too to translate hard-coded strings of
the theme.


Configuration
-------------
Expand Down Expand Up @@ -69,36 +71,6 @@ The language of the exhibit pages is forced to their exhibit’s one.
The pages and exhibits with a language that doesn’t match the current language
are still accessible, as long as the link is known or is hard coded somewhere.

### Translations of specific strings

Often, the theme contains hard-coded strings. To get them translated, you first
need to translate them, then to make them available in Omeka.

#### Translations of strings

In Omeka, the translations are managed with `.po` files in the directory `application/languages/`
for the core and in the directory `languages/` of each enabled plugin. This
plugin works the same.

Simply update the translations files either in the directory `languages/` of the
current theme, either in the directory `languages/` of the plugin: the main one
`template.pot` and each translation like `fr.po` and `fr.mo`. You can add any
language, but respect the names of the files (see `application/languages/`) and
copy the two files `.po` and `.mo` for each language.

The translations themselves can be created with a tool like [poedit], or [lokalize],
or any other compliant software or online service.

#### Reset cache of translations

Omeka uses a cache to store translations. To reset it, go the the config page of
the plugin and check the box. It must be done each time a language is updated.

When the cache is not cleared, you shoud reset the cache manually. You can
restart the web server or to remove all files starting with `omeka_i18n_cache`
in the temp directory of the web server, usually `/tmp`, or `/tmp/systemd-private-xxx/tmp`.
Or wait some hours for the automatic refresh of the translations.

### Theme adaptation

#### Standard functions
Expand All @@ -121,8 +93,6 @@ metadata($item, array('Dublin Core', 'Description'), array('snippet' => 150));
html_escape(snippet(metadata($item, array('Dublin Core', 'Description'), array('no_escape' => true)), 0, 150));
```

For the function metadata(), the key `display_title` may not be translated, so
use `array('Dublin Core', 'Title')`.

#### Specific functions

Expand Down Expand Up @@ -225,19 +195,18 @@ Copyright
* Copyright 2015-2016 Patrick Murray-John (see [patrickmj] on Github)
* Copyright 2017 BibLibre (see [BibLibre] on Github)
* Copyright Daniel Berthereau, 2018 (see [Daniel-KM] on GitHub)
* Copyright Daniele Binaghi, 2021 (see [DBinaghi] on GitHub)


[Multilanguage]: https://github.com/patrickmj/multilanguage
[Omeka]: https://omeka.org
[locale switcher]: https://github.com/Daniel-KM/Omeka-plugin-LocaleSwitcher
[Translations]: https://github.com/Daniel-KM/Omeka-plugin-Translations
[poedit]: https://poedit.net
[lokalize]: https://www.kde.org/applications/development/lokalize
[`helpers/functions.php`]: https://github.com/patrickmj/Multilanguage/blob/master/helpers/functions.php
[flag-icon-css]: http://flag-icon-css.lip.is/
[plugin issues]: https://github.com/patrickmj/Multilanguage/issues
[GNU/GPL v3]: https://www.gnu.org/licenses/gpl-3.0.html
[patrickmj]: https://github.com/patrickmj
[BibLibre]: https://github.com/BibLibre
[Daniel-KM]: https://github.com/Daniel-KM "Daniel Berthereau"

[DBinaghi]: https://github.com/DBinaghi "Daniele Binaghi"
11 changes: 8 additions & 3 deletions helpers/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// From plugin LocaleSwitcher.

/**
* Convert a standard locale string (en_US) into the language and region.
* Convert a standard locale string (en_US) into the language and region.
*
* @param string $locale
* @param boolean $justLanguage
* @return string
*/
function locale_human($locale)
function locale_human($locale, $justLanguage=false)
{
$parts = explode('_', $locale);
if (isset($parts[1])) {
Expand All @@ -23,7 +24,11 @@ function locale_human($locale)
$region = " - $region";
}

return ucfirst($language) . $region;
if (!$justLanguage) {
return ucfirst($language) . $region;
} else {
return ucfirst($language);
}
}

/**
Expand Down
Binary file added languages/it.mo
Binary file not shown.
123 changes: 123 additions & 0 deletions languages/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Translation for the Multilanguage plugin for Omeka.
# Copyright (C) 2014 Patrick Murray-John
# This file is distributed under the same license as the Omeka package.
# Patrick Murray-John <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Daniele Binaghi, 2019
# Giorgia Menghinella <[email protected]>, 2017
# Giorgio Comai <[email protected]>, 2019
msgid ""
msgstr ""
"Project-Id-Version: omeka-plugin-Multilanguage\n"
"Report-Msgid-Bugs-To: http://github.com/patrickmj/Multilanguage/issues\n"
"POT-Creation-Date: 2014-09-21 17:49-0500\n"
"PO-Revision-Date: 2019-09-11 11:48+0000\n"
"Last-Translator: Daniele Binaghi\n"
"Language-Team: Italian (http://www.transifex.com/omeka/omeka-plugin-multilanguage/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgid "Multilanguage"
msgstr "Multilingua"

#: MultilanguagePlugin.php:56 MultilanguagePlugin.php:335
#: MultilanguagePlugin.php:56 MultilanguagePlugin.php:579
#: views/shared/user-language/user-language.php:3
msgid "Preferred Language"
msgstr "Lingua preferita"

#: MultilanguagePlugin.php:335
msgid "Default language is %s."
msgstr "La lingua predefinita è %s."

#: MultilanguagePlugin.php:608
msgid "Translate to: "
msgstr "Traduci in: "

#: views/admin/plugins/multilanguage-config-form.php:2
msgid "To learn more about translating the core interfaces, %sread this%s."
msgstr "Per saperne di più sulla traduzione dell'interfaccia principale, %sleggi questo%s."

#: views/admin/plugins/multilanguage-config-form.php:7
msgid "Automatically append to header"
msgstr "Aggiungi automaticamente all'intestazione"

#: views/admin/plugins/multilanguage-config-form.php:10
msgid "If checked, the switcher will be automatically displayed via the hook \"public_header\", else you need to put it in your theme."
msgstr "Se selezionato, le opzioni di scelta verranno automaticamente mostrate tramite l'hook \"public_header\", altrimenti dovrai inserirli manualmente nel tuoi tema."

#: views/admin/plugins/multilanguage-config-form.php:18
msgid "Reset translations"
msgstr "Annulla le traduzioni"

#: views/admin/plugins/multilanguage-config-form.php:22
msgid "Reset all translations when files in \"plugins/Translations/languages\" or \"themes/my-theme/languages\" were updated manually."
msgstr "Annulla tutte le traduzioni quandi i file in \"plugins/Translations/languages\" or \"themes/my-theme/languages\" sono aggiornati manualmente."

#: views/admin/plugins/multilanguage-config-form.php:30
msgid "Language display mode"
msgstr "Modo di visualizzazione lingua"

#: views/admin/plugins/multilanguage-config-form.php:33
msgid "Select the language display mode for your site (both Admin and Public side)."
msgstr "Seleziona il modo di visualizzazione lingua per il tuo sito (sia lato Admin che Pubblico)"

#: views/admin/plugins/multilanguage-config-form.php:36
msgid "Flag (default)"
msgstr "Bandiera (predefinito)"

#: views/admin/plugins/multilanguage-config-form.php:37
msgid "2-letters language code"
msgstr "Codice lingua di 2 lettere"

#: views/admin/plugins/multilanguage-config-form.php:38
msgid "Full language name"
msgstr "Nome intero della lingua"

#: views/admin/plugins/multilanguage-config-form.php:45
msgid "Languages"
msgstr "Lingue"

#: views/admin/plugins/multilanguage-config-form.php:48
msgid "Select the languages into which your site can be translated."
msgstr "Seleziona le lingue in vuoi rendere traducibile il tuo sito"

#: views/admin/plugins/multilanguage-config-form.php:52
msgid "Language"
msgstr "Lingua"

#: views/admin/plugins/multilanguage-config-form.php:53
msgid "Code"
msgstr "Codice"

#: views/admin/plugins/multilanguage-config-form.php:54
msgid "Public"
msgstr "Pubblico"

#: views/admin/plugins/multilanguage-config-form.php:55
msgid "Admin"
msgstr "Admin"

#: views/admin/plugins/multilanguage-config-form.php:80
msgid "Record Elements"
msgstr "Elementi dei record"

#: views/admin/plugins/multilanguage-config-form.php:83
msgid "Check the metadata fields that you want to make translatable."
msgstr "Seleziona i campi di metadati che vuoi rendere traducibili"

#: views/shared/user-language/user-language.php:8
msgid "Select your preferred language"
msgstr "Seleziona la tua lingua preferita"

#: views/shared/user-language/user-language.php:11
msgid "The default language is %s"
msgstr "La lingua predefinita è"

#: views/shared/user-language/user-language.php:20
msgid "Save Changes"
msgstr "Salva modifiche"
42 changes: 21 additions & 21 deletions languages/template.base.pot
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Translation for the Multilanguage plugin for Omeka.
# Copyright (C) 2014 Patrick Murray-John
# This file is distributed under the same license as the Omeka package.
# Patrick Murray-John <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Locale\n"
"Report-Msgid-Bugs-To: http://github.com/patrickmj/Multilanguage/issues\n"
"POT-Creation-Date: 2014-09-21 17:49-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "Multilanguage"
msgstr ""
# Translation for the Multilanguage plugin for Omeka.
# Copyright (C) 2014 Patrick Murray-John
# This file is distributed under the same license as the Omeka package.
# Patrick Murray-John <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Locale\n"
"Report-Msgid-Bugs-To: http://github.com/patrickmj/Multilanguage/issues\n"
"POT-Creation-Date: 2014-09-21 17:49-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Multilanguage"
msgstr ""
Loading