olligranlund
Forum Replies Created
-
Hello
This is enough for me to make a workaround with some home_url() and string replacements ?? Thank you for the updated instructions. I noticed that there is a small issue in the instructions with the parameter name.
“$language” should be “$target_language”
Also, you mention language code yet you show a locale code e.g. “en” vs “en_GB”. I tested this with language codes and got it working, maybe you could update the example to host “en” or some other language like “es” to clarify it.
In my use case I would need the translation slugs during PHP-processing. I feel that it would be really wrong to have to do a wp_remote_get towards the internal API just to get a version of a URL in a different language. I would appreciate if you could expose some functions from the plugin that custom/integration solutions would be more manageable ??
I think I could do a workaround with that rest-api solution but right now it feels much more tedious than it should be.
Any updates on this?
One isse that comes directly up when using home_url() is that I need to verify the data of various languages under one locale, hence needing somehow in a iteration to check what the permalink for a specific page is.
Maybe this pseudocode helps to bring up the issue:
e.g.
$permalinks = [];
$languages = get_all_used_two_letter_language_slugs();
$parent_page_id = 123;
foreach( $languages as $lang ){
$permalinks[$lang] = get_permalink($parent_page_id);
}The home_url() can maybe give the right language but I would still be missing the translated name of the page, if someone uses the Pro-version of your plugin. Also building the language manually in would not be feasible as the language could be /en/ or /english/ or something else.
Hello Alex
I noticed the same thing that you are re-using the same post-id for both language version. I’m currently developing a plugin and would like to add support for Translatepress but I’m unable to fully do that due to not having the right tools.
I’m looking for a way to get the permalink of a specific page in specific language, do you offer any hook or function that could be utilized for this?
The plugin that I’m developing creates dynamic pages with add_rewrite_rule and populates those with content. You pretty much choose a parent page, and if the parent page URL had some set sub-pages in the URL, the rewrite rule kicks in and returns a page according to the specs in the URL. E.g. “exampleurl.com/parent/post1234” where post1234 comes from a external source and is being served if we get a match at “exampleurl.com/parent/%s”.
If you could provide some hook so that I could get the permalink of a specific language, I would be able to make the plugin I’m working on to support Translatepress fully.
One example how it could look like:
$value = apply_filters( ‘trp_permalink’, ‘domain.com/parent’, ‘de’ );and $value would become “domain.com/de/elternteil”
Forum: Plugins
In reply to: [Loco Translate] Loco Translate can’t find strings in functions or classesYou are so right. I guess I need to dig deeper~ Anyways I want to say thank you for these quick replies ??
Forum: Plugins
In reply to: [Loco Translate] Loco Translate can’t find strings in functions or classesThanks for the quick reply, really appreciated.
About the second call, it’s from another part of my script and inside PHP-tags ??
I just noticed that if I have the translation done separately, it still wont be translated to default language. I guess this means your plugin is working fine and the issue is somewhere else in my code.
Here is anyways one example of my code:
`<p>
<label for=”phone”><?php _e( ‘Phone’, ‘somesite_registration’ ) ?><br />
<input type=”tel” name=”phone” id=”phone” class=”input” value=”<?php echo esc_attr( wp_unslash( $phone ) ); ?>” size=”25″ /></label>
</p>`******And here is my translation for it in a .po file for Finnish*******
... #: somesite_scripts.php:116 msgid "Phone" msgstr "Puhelin" ...
- This reply was modified 7 years, 7 months ago by olligranlund. Reason: Wrong formatting
- This reply was modified 7 years, 7 months ago by olligranlund.
- This reply was modified 7 years, 7 months ago by olligranlund.
- This reply was modified 7 years, 7 months ago by olligranlund.