PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Oct 14, 2019 9:14 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Oct 10, 2016 11:34 pm 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
I was just going through the default twig theme files in bolt CMS and came across the following lines of code , in the listing.twig file.

Syntax: [ Download ] [ Hide ]
{% if taxonomytype is defined %}
            <h1>
                {{ __('general.phrase.overview-for') }}
                {% if taxonomy.options[slug] is defined %}
                    {{ taxonomy.options[slug] }}
                {% else %}
                    {{ slug }}
                {% endif %}
            </h1>
            {# Taxonomies are fetched unordered by design except if 'has_sortorder'
              is set to true. This way we keep 'grouping' intact in the listing. #}
           {% if not taxonomy.has_sortorder %}
                {# If we specified an order in config.yml, sort them here, accordingly: #}
               {% set records = records|order(app.config.get('general/listing_sort')) %}
            {% endif %}
        {% endif %}


My doubt is about the below line of code:

Syntax: [ Download ] [ Hide ]
{{ __('general.phrase.overview-for') }}


The above line i believe outputs some content. But what exactly does
Syntax: [ Download ] [ Hide ]
general.phrase.overview-for
mean and where is it coming from ??


Top
 Profile  
 
PostPosted: Tue Oct 11, 2016 12:29 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
I don't know bolt, but functions named __ are typically for translations. Is there a place where those are defined?


Top
 Profile  
 
PostPosted: Tue Oct 11, 2016 10:28 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
requinix ,somebody actually answered that question on SO here : http://stackoverflow.com/a/39970060/4381665,

I still dont understand what it is being used for.

Also in the below line of code:

Syntax: [ Download ] [ Hide ]
{{ __('general.phrase.overview-for') }}


what is general.phrase.overview-for ?

BTW , i think celauran uses bolt , so he might have a clue :D


Top
 Profile  
 
PostPosted: Tue Oct 11, 2016 11:32 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
If you know the answer to "what is __" then you should know what the answer to "what is it being used for". Hint: it's the same answer.

"general.phrase.overview-for" is the identifier for the string.

Or wait for Celauran. Whatever.


Top
 Profile  
 
PostPosted: Tue Oct 11, 2016 11:36 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
actually i did't quite understand the usage of __ too :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group