1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help with options in phrases

Discussion in 'XenForo Development Discussions' started by Matthew Hawley, Jul 7, 2013.

  1. Matthew Hawley

    Matthew Hawley Well-Known Member

    So I added an option to a phrase and this is what shows up.

    rmphraseproblem.png

    Any suggestions? Thanks!
    @Chris Deeming @Waindigo
     
    Last edited: Jul 7, 2013
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Options aren't evaluated in phrases. You'd have to use a named variable {singular} and pass it in via the template:
    {xen:phrase x, singular={yourOption}}

    I'm on mobile so that syntax is probably not correct, but that's what you'll have to do.
     
  3. Matthew Hawley

    Matthew Hawley Well-Known Member

    I know its correct. So I'd have to go into each template and add {xen:phrase x, singular={yourOption}? Then can I add {singular} to the phrases?
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Yes.
     
  5. Matthew Hawley

    Matthew Hawley Well-Known Member

    Wait so I have to do:

    Code:
    {xen:phrase x, singular={yourOption}
    for EACH phrase?
     
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    Yes. If you want to define a {singular} variable for the phrase. I'd verify my syntax before you do a full on replace.
     
    Last edited: Jul 7, 2013
  7. Vincent

    Vincent Well-Known Member

    Yep, don't forget to close your first '{' though and to use these: '
    I'd use a File Comparison tool if I were you :)
     
  8. Matthew Hawley

    Matthew Hawley Well-Known Member

    So can I add this to one template or do I have to add it to all templates?
     
  9. Jeremy

    Jeremy XenForo Moderator Staff Member

    Every time you use that phrase (where you have a variable defined), you must pass it a value.
     
  10. Matthew Hawley

    Matthew Hawley Well-Known Member

    Ugh okay. 223 phrases to do. Time to get to work.
     
  11. Matthew Hawley

    Matthew Hawley Well-Known Member

    Wait is this the correct format?

    Code:
    {xen:phrase adds_update_to_watched_resource, noncapitalsingular={nonCapitalizedRMSingularPhrases}
     
  12. Jeremy

    Jeremy XenForo Moderator Staff Member

    For one, you didn't close your opening curly brace. And no, it isn't.

    This is (taken from XI blog):
    HTML:
    {xen:phrase xi_blog_x_added_you_as_an_author_to_blog_entry_y,
        'name={xen:helper username, $user, 'subject'}',
        'title=<a href="{xen:link 'blog-entries', $content}" class="PopupItemLink">{$content.title}</a>'}
     
  13. Matthew Hawley

    Matthew Hawley Well-Known Member

    Then what is the correct format? Besides the curly brace.
     
  14. Jeremy

    Jeremy XenForo Moderator Staff Member

    HTML:
    {xen:phrase xi_blog_x_added_you_as_an_author_to_blog_entry_y,
        'name={xen:helper username, $user, 'subject'}',
        'title=<a href="{xen:link 'blog-entries', $content}" class="PopupItemLink">{$content.title}</a>'}
     
  15. Matthew Hawley

    Matthew Hawley Well-Known Member

    Could you post that as this?

    Code:
    {xen:phrase adds_update_to_watched_resource, noncapitalsingular={nonCapitalizedRMSingularPhrases}
     
  16. Jeremy

    Jeremy XenForo Moderator Staff Member

    You need to surround your variables (nocapitalsingular=x) with singular quotes. And you need to close your curly braces properly.
     
  17. Matthew Hawley

    Matthew Hawley Well-Known Member

    Code:
    {xen:phrase adds_update_to_watched_resource, noncapitalsingular={'nonCapitalizedRMSingularPhrases'}}
    So like that?
     
  18. Jeremy

    Jeremy XenForo Moderator Staff Member

    No. Compare the format I posted to yours, you should be able to spot the differences.
     
  19. Matthew Hawley

    Matthew Hawley Well-Known Member

    So this?

    Code:
    {xen:phrase adds_update_to_watched_resource, 'noncapitalsingular={nonCapitalizedRMSingularPhrases}'}
     
  20. Jeremy

    Jeremy XenForo Moderator Staff Member

    Test it and see. You may have problems with how you are passing the value to the variable in your phrase.
     

Share This Page