question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Translations get cut off after 1 character.

See original GitHub issue

Using the following I get a strange quirk…

Screen_Shot_2017_09_18_at_9_43_08_PM

interface HomePageState {
    translate: any;
}

type HomePageProps = HomePageState

class Home extends React.Component<HomePageProps, HomePageState> {   
    /// the below will only render "I"
    public render(): any {
        return <label>{ this.props.translate("home.slogan") }</label>;
   }
}

const addTranslateToProps = state => {
    console.log('state.locale', state.locale);
    // this will log out "translations: { home.slogan: "I'm the correct translation" }
    return {
        translate: getTranslate(state.locale)
    }
};

export default connect(
    addTranslateToProps
)(Home) as typeof Home;

To be clear: The translations state seems to contain the correct translation / localization, but the translate function exposed via props, does not work as expected.

I do believe it might be a dependent lib (reselect??) thats causing the problem, but not too sure… if anyone has encountered this before, any advice would be appreciated. I’m happy to supply any other information thats needed.

Other info: Stack is on top of dotnetcore, React + Redux + SSR (with webpack for bundling front end stuff)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ryandrewjohnsoncommented, Sep 19, 2017

@rohan-buchner would you be able to provide the following:

  • a sample of your original translation data that you pass to addTranslate
  • a look at how you are calling the initialize action? What are the languages And options you are passing? ( one strange thing I noticed is that your default language seems to be set to “localizations” which would mean you have a language code in your translation data with this name)
  • what version of library are you using?

Also have you tried adding additional translations? Does this occur for others as well? If not I would try removing the apostrophe from “I’m” and see if that makes a difference. By any chance are you copy and pasting the content from another program like Word? If it is the apostrophe causing issues I suspect it could be an encoding issue.

Thanks

0reactions
ryandrewjohnsoncommented, Sep 19, 2017

Glad it worked out. I think I’m going to try and tighten up the typings for the translation data, as that might help catch this issue for anyone using TypeScript or Flow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove punctuation marks from a string in Python 3.x ...
punctuation , just concatenate string.punctuation with a string of characters you also want removed, like translator = str.maketrans({key: None ...
Read more >
How to break lines - TED Translators Wiki
Below, you will find strategies you can use when deciding where to break the subtile into two lines. Keep the line length balanced....
Read more >
SQL Server TRANSLATE() Function - W3Schools
The TRANSLATE() function returns the string from the first argument after the characters specified in the second argument are translated into the characters ......
Read more >
Translation Considerations for Flows - Salesforce Help
When you use Translation Workbench to translate flows, note these considerations. ... Other translations for flow labels have a maximum of 1,000 characters....
Read more >
KB42953: After translation is imported through MicroStrategy ...
KB42953: After translation is imported through MicroStrategy Repository Translation Wizard, translation strings are missing or cut off in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found