Return to Support

Change default texts but not in the po-fil

Home Forums Graphene WordPress theme Support Change default texts but not in the po-fil

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #9587
    KingSwiff
    Member

    I found this treat:

    Link

    and it works perfect, but can I change the archive text and not in the po-fil?

    In danish it’s:

    Kategori arkiv:

    But at my coming site its not an archive, so I just want:

    Kategorien

    #44058
    Anonymous
    Member

    https://forum.graphene-theme.com/graphene-support/change-text-in-search-field-and-buttons

    Change it to whatever you want in the .po file and generate the .mo file. See the link above.

    Line 19-23 in da_DK.po file:

    #@ graphene
    #: category.php:13
    #, php-format
    msgid "Category Archive: <span>%s</span>"
    msgstr "Kategori arkiv: <span>%s</span>"

    EDIT: I don’t think you can change this anywhere else other than the .po file. Why don’t you want to change it in the .po file anyways?

    #44059
    KingSwiff
    Member

    Yes, i’m aware of this, but wound my changes disappear, when there’s an update in the po-file?

    I made the last translation to the danish po-fil, and when I did, I had to be true to the translation and not to my site πŸ™‚ Even I found out some of the texts would need a sharper pen πŸ™‚

    #44060
    Anonymous
    Member

    From what I have researched you have top copy the original files over to the child theme and make sure the directory setup is the same as in the parent theme (original).

    This would go into your functions.php (child):

    <?php
    function my_child_theme_setup() {
    load_child_theme_textdomain( 'graphene',
    get_stylesheet_directory() );
    }
    add_action( 'after_setup_theme', 'my_child_theme_setup' );
    ?>

    “graphene” = the name of your original graphene directory

    I don’t know, if it is enough to only add the changes to the .po file or if you have to add the entire content. Maybe you can test this and post back with the result.

    #44061
    KingSwiff
    Member

    i’ll be glad to test, but i’m not sure, what I have to do?

    I create the file function.php in my child theme and put in this code:

    <?php
    function my_child_theme_setup() {
    load_child_theme_textdomain( 'graphene',
    get_stylesheet_directory() );
    }
    add_action( 'after_setup_theme', 'my_child_theme_setup' );
    ?>

    And what I have to do now, I don’t understand?

    #44062
    Anonymous
    Member

    You have to create the same folders in your child theme that direct you to the mo. and .po files in your original theme.

    #44063
    KingSwiff
    Member

    I made the folder “languages” in the child theme and the po- and the mo-file withe or without of the top of the fil – no effect.

    This is what I put in top of the fil:

    msgid ""
    msgstr ""
    "Project-Id-Version: Graphene 1.0 theme for WordPressn"
    "Report-Msgid-Bugs-To: n"
    "POT-Creation-Date: 2014-11-12 19:38+0100n"
    "PO-Revision-Date: 2014-12-07 22:22+0100n"
    "Last-Translator: Henrik Wahlqvist <henrik@wahlqvist.dk>n"
    "Language-Team: n"
    "Language: da_DKn"
    "MIME-Version: 1.0n"
    "Content-Type: text/plain; charset=UTF-8n"
    "Content-Transfer-Encoding: 8bitn"
    "Plural-Forms: nplurals=2; plural=n != 1;n"
    "X-Poedit-SourceCharset: UTF-8n"
    "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
    "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2n"
    "X-Poedit-Basepath: /Users/henrik/Downloads/test/wp-content/themes/"
    "graphene/n"
    "X-Textdomain-Support: yesn"
    "X-Generator: Poedit 1.7.1n"
    "X-Poedit-SearchPath-0: .n"

    #44064
    Anonymous
    Member

    Have you also tried it with the original da_DK.po and changed the text you want to change? Then you generate the associated .mo file here and upload both files to the proper folder /graphene-child/languages/.

    Also try it again with this function:

    load_theme_textdomain( 'graphene', get_stylesheet_directory() . '/languages' );

    If all this won’t work then there is only 2 options left.

    Install the plugin CodeStyling Localisation (Tutorial) or change the text in the original language file. But I don’t know if it will be overridden with the next update.

    #44065
    KingSwiff
    Member

    Okay, I have tried to put the original po and mo file into /graphene-child/languages/ – no effect.

    I have put in this text in functions.php:

    load_theme_textdomain( 'graphene', get_stylesheet_directory() . '/languages' );

    … with the result that the text pop up as text in start of homepage..?

    It no option to override the original file, be course it will disappear after an update.

    #44066

    Or, you can try this:

    Try leaving the .po and .mo files alone, and then trying this technique in your child theme’s functions.php file:

    https://forum.graphene-theme.com/graphene-support/changing-text-strings#post-22833

    #44067
    KingSwiff
    Member

    ARGH, sorry Anonymous, your guide worked PERFECT – I forgot this in your second code:

    <?php
    ?>

    Now all works GREAT and I can just take small pieces of the translation and make my own, where the rest come from the theme.

    Let me explain if somebody else can use it one day.

    Create the file functions.php and put in this code:

    <?php
    load_theme_textdomain( 'graphene', get_stylesheet_directory() . '/languages' );
    ?>

    Create the folder languages in your child theme.

    Copy the top of the original po-fil and put it into the top of your new po-file (or download the original one, make changed and make it the new one for the child theme)

    Find the text in the original po-file you want to change, it could be like this small translation:

    #@ graphene
    #: category.php:13
    #, php-format
    msgid "Category Archive: <span>%s</span>"
    msgstr "Kategori arkiv: <span>%s</span>"

    I changed it for this:

    #@ graphene
    #: category.php:13
    #, php-format
    msgid "Category Archive: <span>%s</span>"
    msgstr "Kategorien <span>%s</span>"

    When you have changed what you want to change, create a mo-file out of the po-file and upload both to your folder languages in the child theme

    Your are safe πŸ™‚

    Kenneth, I also tried the link you send me, but couldn’t make it work – and this time I remembered <?php ?> πŸ™‚

    Thanks again to both of you!

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.