Opened 2 years ago

Closed 2 years ago

#5331 closed change (fixed)

Add has_string to CMS

Reported by: juliandoucette Assignee: jsonesen
Priority: P3 Milestone:
Module: Sitescripts Keywords:
Cc: wspee, kvas, jsonesen, ire, saroyanm Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29469568/

Description

Background

We currently have a get_string funcion in adblockplus/cms. This is being used on adblockplus.org for menu links that appear on each page and do not need to be in each page's locale file. It would be useful to have a has_string function so that we could use get_string conditionally. e.g.

<title>
  {% if title %}{{ title }}{% endif %}
  {% if has_string('site_title', site) %} | {{ get_string('site_title', site) }}{% endif %}
</title>

Note: I'm not entirely sure has_string and get_string is the best way to go to define site wide strings because it requires that create and manage a locale file manually. I'm open to suggestion here.

What to change

Implement a global has_string function that accepts a string name and locale file and returns a boolean.

Change History (5)

comment:1 Changed 2 years ago by kvas

  • Priority changed from Unknown to P3
  • Ready set

comment:2 Changed 2 years ago by jsonesen

  • Owner set to jsonesen

comment:3 Changed 2 years ago by jsonesen

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:4 Changed 2 years ago by abpbot

A commit referencing this issue has landed:
Issue 5331 - Add has_string() default global...

comment:5 Changed 2 years ago by kvas

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.