Change default texts but not in the po-fil

  • KingSwiff

    #9587

    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

    Anonymous

    #44058

    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?

    KingSwiff

    #44059

    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 🙂

    Anonymous

    #44060

    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.

    KingSwiff

    #44061

    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?

    Anonymous

    #44062

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

    KingSwiff

    #44063

    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"

    Anonymous

    #44064

    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.

    KingSwiff

    #44065

    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.

    Mod

    Kenneth John Odle

    #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

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

You must be logged in to reply to this topic.