From 46c2f840000513c00a1051ecad3cc51160ac80e6 Mon Sep 17 00:00:00 2001 From: Lunga Baliwe Date: Tue, 15 Oct 2024 22:49:32 +0200 Subject: [PATCH] LIMS-1145: Translations --- .../browser/listingview/samples.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/bika/aquaculture/browser/listingview/samples.py diff --git a/src/bika/aquaculture/browser/listingview/samples.py b/src/bika/aquaculture/browser/listingview/samples.py new file mode 100644 index 0000000..bfc747f --- /dev/null +++ b/src/bika/aquaculture/browser/listingview/samples.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +from zope.component import adapts +from zope.interface import implements + +from bika.aquaculture.config import is_installed +from bika.aquaculture.config import _ +from senaite.app.listing.interfaces import IListingView +from senaite.app.listing.interfaces import IListingViewAdapter + + +class SamplesListingViewAdapter(object): + adapts(IListingView) + implements(IListingViewAdapter) + + def __init__(self, listing, context): + self.listing = listing + self.context = context + + def before_render(self): + if not is_installed(): + return + spt = "getSamplePointTitle" + if spt in self.listing.columns: + self.listing.columns[spt]["title"] = _("Pond") + + spl = "SamplePointLocation" + if spl in self.listing.columns: + self.listing.columns[spl]["title"] = _("Pond Location") + + stt = "getSampleTypeTitle" + if stt in self.listing.columns: + self.listing.columns[stt]["title"] = _("Specimen Type") + + loc = "location" + if loc in self.listing.columns: + self.listing.columns[loc]["title"] = _("Pond Location") + + def folder_item(self, obj, item, index): + if not is_installed(): + return item + return item